Public
Edited
May 30, 2023
Insert cell
Insert cell
{
const mean = 0; // Mean of the bell curve
const variance = 1; // Variance of the bell curve

const data = [];
for (let x = -3; x <= 3; x += 0.1) {
const y = (1 / Math.sqrt(2 * Math.PI * variance)) * Math.exp(-((x - mean) ** 2) / (2 * variance));
data.push({ x, y });
}

const spec = {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": { "values": data },
"mark": "line",
"encoding": {
"x": { "field": "x", "type": "quantitative" },
"y": { "field": "y", "type": "quantitative" }
}
};

const el = svg();
VegaLite({ el, spec, actions: false });
el;
}








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