Public
Edited
Aug 16, 2024
3 forks
Importers
16 stars
Insert cell
Insert cell
Plot.plot({
x: {
// map all dates to 2000 by removing n * 365.24 days; Feb 29 will not create a gap
transform: (d) => d3.utcDay.offset(d, (2000 - d.getUTCFullYear()) * 365.24),
tickFormat: "%b",
line: true
},
y: { nice: true, grid: true, zero: true },
marks: [
Plot.line(data, {
x: "date",
y: "extent",
stroke: ({ date }) => date.getUTCFullYear(), // z separates the lines
})
]
})
Insert cell
Insert cell
Plot.plot({
x: {
// map all dates to 2000 (a *leap-year*) by removing n years; Feb 29 will be skipped if missing
transform: (d) => d3.utcYear.offset(d, 2000 - d.getUTCFullYear()),
tickFormat: "%b",
line: true
},
y: { nice: true, grid: true, zero: true, label: "↑ ice extent" },
marks: [
Plot.line(data, {
x: "date",
y: "extent",
stroke: ({ date }) => date.getUTCFullYear()
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = FileAttachment("sea-ice-extent.csv").csv({ typed: true })
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more