Public
Edited
May 17, 2024
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1152,
height: 600,
grid: true,
x: { type: "log", domain: [200, 100e3] },
y: { domain: [15, 85], ticks: 8 },
color: { legend: true },
marks: [
Plot.dot(nations, Plot.groupZ({
x: lastDefined,
y: lastDefined,
r: lastDefined,
fill: "last"
}, {
filter: (d) => d.year <= year,
x: "income",
y: "lifeExpectancy",
r: "population",
fill: "region",
opacity: 0.7,
z: "name",
tip: true
}))
]
})
Insert cell
lastDefined = ({
reduceIndex(I, X) {
for (let i = I.length - 1; i >= 0; --i) {
const x = X[I[i]];
if (x != null) {
return x;
}
}
}
})
Insert cell
nations = FileAttachment("nations.csv").csv({typed: true})
Insert cell
import {Scrubber} from "@mbostock/scrubber"
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