Public
Edited
Feb 18, 2024
1 fork
Insert cell
Insert cell
viewof x_input = Inputs.range([-2.8, 2.8], {
label: "Amount",
step: 0.05,
format: (x) => x + 60
})
Insert cell
y_input = -0.6 + 0.15 * x_input * x_input
Insert cell
data_frame = [x_input, y_input]
Insert cell
Insert cell
Insert cell
Insert cell
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