Plot.plot({
x: { label: "Daily low temperature (°F) →", nice: true },
y: { label: "↑ Daily temperature variation (Δ°F)", zero: true },
aspectRatio: 1,
color: {
type: "cyclical",
legend: true,
tickFormat: Plot.formatMonth()
},
marks: [
Plot.ruleY([0]),
Plot.dot(temps, {
fill: (d) => d.date.getUTCMonth(),
x: "temp_min",
y: delta
}),
Plot.dot(temps, Plot.selectMaxY({ x: "temp_min", y: delta, r: 5 })),
Plot.text(
temps,
Plot.selectMaxY({
x: "temp_min",
y: delta,
text: "date",
lineAnchor: "bottom",
dy: -10
})
)
]
})