Public
Edited
Nov 1, 2023
4 stars
Insert cell
Insert cell
Plot.plot({
height: 500,
grid: true,
insetLeft: 60,
insetBottom: 60,
marks: [
Plot.spike(faithful, {
x: (d, i) => d["waiting"] + jitter[2 * i],
frameAnchor: "bottom",
opacity: 0.2,
stroke: "steelblue" // stroke+fill
}),
Plot.spike(faithful, {
y: (d, i) => d["eruptions"] + jitter[2 * i + 1] / 60,
frameAnchor: "left",
opacity: 0.2,
stroke: null,
fill: "orangered",
rotate: 90
}),
Plot.density(faithful, { x: "waiting", y: "eruptions" }),
Plot.dot(faithful, {
x: (d, i) => d["waiting"] + jitter[2 * i],
y: (d, i) => d["eruptions"] + jitter[2 * i + 1] / 60,
r: 2,
fill: "currentColor"
})
]
})
Insert cell
jitter = Float32Array.from(
{ length: 2 * faithful.length },
() => Math.random() - 0.5
)
Insert cell
faithful = FileAttachment("faithful.csv").csv({ typed: true })
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