Published
Edited
Jun 29, 2022
9 stars
Insert cell
Insert cell
Plot.plot({
width,
color: { scheme: "burd" },
x: { axis: null },
marginRight: 5,
marginBottom: 8,
height: 140,
marks: [
Plot.barX(data, {
x: "year",
interval: 1,
fill: "anomaly",
insetRight: -0.5,
insetTop: 11
}),
Plot.tickX(data, {
x: "year",
filter: (d) => d.year % 10 === 0
}),
Plot.text(data, {
frameAnchor: "top",
x: "year",
filter: (d) => d.year % 10 === 0,
text: (d) =>
[1880, 1900, 2000].includes(d.year) ? `${d.year}` : `’${d.year % 100}`,
textAnchor: "start",
dx: 3
})
]
})
Insert cell
Insert cell
Plot.barX(data, { x: "year", interval: 1, fill: "anomaly" }).plot()
Insert cell
data = FileAttachment("anomaly.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