Plot.plot({
width,
height: 900,
color: {
legend: true,
type: "diverging",
reverse: true,
label: "Average Annual Temperature Anomaly (°C)",
},
x: {
axis: null,
},
y: {
axis: null,
},
r: {
type: "linear",
range: [2, years.length*scale],
domain: d3.extent(anomalies, d => d.year),
},
marks: [
Plot.dot(anomalies, {
x: () => 0,
r: "year",
stroke: "value",
strokeWidth: 2,
}),
Plot.dot([highlight], {
x: () => 0,
r: (y) => y,
stroke: "black",
strokeDasharray: 4,
strokeWidth: 1.5,
}),
Plot.text([highlight], {
x: () => 0,
text: (y) => `${y}\n${anomaly} °C`,
fontSize: 20,
}),
]
})