Published
Edited
Jul 6, 2022
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
yearMean = formatMean(d3.mean(yearData.values()))
Insert cell
formatMean = d3.format(",.2f");
Insert cell
data = new Map([
...d3.rollup(
entries,
(v) => d3.sum(v, (d) => d.rate),
(d) => +d.year,
(d) => d.name
)
])
Insert cell
Insert cell
dataDomainNu = [-3, 3]
Insert cell
Insert cell
countries_pop_rate = FileAttachment("countries_pop_rate.csv").csv()
Insert cell
Insert cell
Insert cell
color = d3
.scaleSequential()
.domain(dataDomainNu)
.interpolator(colorInterpolator)
.unknown("#ccc")
Insert cell
projection = d3.geoEqualEarth() // Use an equal-area projection for choropleth maps
Insert cell
path = d3.geoPath(projection)
Insert cell
width = 900
Insert cell
height = {
const [[x0, y0], [x1, y1]] = d3.geoPath(projection.fitWidth(width, outline)).bounds(outline);
const dy = Math.ceil(y1 - y0), l = Math.min(Math.ceil(x1 - x0), dy);
projection.scale(projection.scale() * (l - 1) / l).precision(0.2);
return dy;
}
Insert cell
outline = ({type: "Sphere"})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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