Unlisted
Edited
Apr 20, 2023
Insert cell
Insert cell
Plot.plot({
x: {
ticks: d3.ticks(...d3.extent(hadcrut, (d) => d.year), 10),
tickFormat: "d",
interval: 1, // recommended in case of missing data
label: null
},
color: {
scheme: "BuRd"
},
marks: [
Plot.cell(hadcrut, {x: "year", fill: "anomaly"})
]
})
Insert cell
hadcrut = (await FileAttachment("hadcrut-annual.txt").text())
.trim().split(/\n/g) // split into lines
.map(line => line.split(/\s+/g)) // split each line into fields
.map(([year, anomaly]) => ({ // extract the year and median anomaly
year: +year, // as a number
anomaly: +anomaly
}))
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