Public
Edited
Jan 20, 2024
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
tickFormat: "+f",
label: "↑ Surface temperature anomaly (°F)"
},
color: {
scheme: "BuRd",
legend: true
},
marks: [
Plot.dot(gistemp, {x: "Date", y: "Anomaly", stroke: "Anomaly"}),

// Custom mark for adding a dashed line at y=0 when plot contains both pos and neg data.
(index, scales, values, dimensions) => {
const [y_min, y_max] = scales.scales.y.domain;

if (y_min < 0 && y_max >= 0) {
return Plot.ruleY([0], {strokeDasharray: 10, opacity: 0.5});
}
}
]
})
Insert cell
gistemp = FileAttachment("gistemp.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