Public
Edited
Sep 7, 2023
Fork of CPP Opt
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 75,
// width: 625,
insetLeft: 20,
x: {
domain: [-5, 5],
label: "Cerebral Perfusion Pressure (mmHg)",
axis: "bottom",
tickFormat: (d) => d + 60,
ticks: 5
//axis: null
},
y: {
domain: [-1000, 1000],
label: "PRx",
axis: null
},
marks: [
Plot.areaY(shade3, { x: "x", y: "y", fill: "#4ED762", opacity: 0.2 }),
Plot.areaY(shade4, { x: "x", y: "y", fill: "#4ED762", opacity: 0.2 }),
Plot.areaY(shade5, { x: "x", y: "y", fill: "#FD2E55", opacity: 0.2 }),
Plot.areaY(shade6, { x: "x", y: "y", fill: "#FD2E55", opacity: 0.2 }),
Plot.areaY(shade7, { x: "x", y: "y", fill: "#FD2E55", opacity: 0.2 }),
Plot.areaY(shade8, { x: "x", y: "y", fill: "#FD2E55", opacity: 0.2 }),
Plot.lineY(func, {
x: "x",
y: "y",
stroke: "black",
// strokeDasharray: "2,4",
strokeWidth: 3
}),
Plot.dot(data_frame, {
x: x_input,
y: y_input,
r: 10,
fill: dot_color,
stroke: "#797979",
strokeWidth: 1,
symbol: "circle"
})
]
})
Insert cell
dot_color = {
if (data_frame[1] > 0.3) {
return "#FD2E55";
} else {
return "#4ED762";
}
}
Insert cell
Insert cell
xmin = -3 // specify minimum for x
Insert cell
xmax = 3 // specify maximum for x
Insert cell
int = 0.1 // specify interval for steps between xmin and xmax; adjust for smoothness
Insert cell
f = (x) => -0.6 + 0.15 * x * x // the function to be plotted. in this case a quadratic
Insert cell
func = {let dd = []; for(let i = xmin; i <= xmax; i = i+int) dd.push({x: i, y: f(i)}); return dd}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more