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
})
]
})