Public
Edited
Dec 8, 2023
Paused
1 fork
2 stars
Insert cell
Insert cell
normalized_histogram = Plot.plot({
marks: [
Plot.rectY(
pts,
Plot.binX(
{
y: (a, bin) => {
return a.length / pts.length / (bin.x2 - bin.x1);
}
},
{ fill: "gray" }
)
),
Plot.line(
d3.range(-4, 4, 0.02).map((x) => [x, f(x)]),
{ stroke: "#B00", strokeWidth: 4 }
),
Plot.ruleX([0]),
Plot.ruleY([0])
]
})
Insert cell
f = (x) => Math.exp((-x * x) / 2) / Math.sqrt(2 * Math.PI)
Insert cell
pts = d3.range(0, 5000).map(d3.randomNormal())
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