Published
Edited
Dec 2, 2020
Importers
1 star
Also listed in…
maps and geo
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
colorScale = d3
.scaleThreshold()
.domain([10, 100, 1000, 10000, Math.ceil(d3.max(data, d => d.value))])
.range(d3.schemeRdPu[5])
Insert cell
tooltipContents = ({ id, value }) =>
`${countyFipsToName.get(id)}<br>~<strong>${d3.format(",.2f")(
value
)}</strong> ppl/sqkm`
Insert cell
data = Array.from(countyPopDensityByFips).map(([id, props]) => ({
id,
value: props.pop_density
}))
Insert cell
import { drawChoroplethMap } from "@clhenrick/reusable-choropleth-map"
Insert cell
import { countyPopDensityByFips } from "@clhenrick/us-county-population-density"
Insert cell
import { countyFipsToName } from "@clhenrick/us-census-constants"
Insert cell
import { legend } from "@d3/color-legend"
Insert cell
d3 = require("d3-scale@2", "d3-scale-chromatic@2", "d3-array@2", "d3-format@2")
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