Public
Edited
May 12, 2023
2 forks
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(func, {x: "x", y: "y"})
]
})
Insert cell
Insert cell
xmin = -5 // specify minimum for x
Insert cell
xmax = 5 // specify maximum for x
Insert cell
int = 0.25 // specify interval for steps between xmin and xmax; adjust for smoothness
Insert cell
f = (x) => 1 + x + 0.5 * 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