Public
Edited
May 23, 2023
1 fork
Insert cell
Insert cell
map = Plot.plot({
projection: "albers-usa",
width: 900,
color: {
type: "quantile",
scheme: "blues",
label: "Density (population per square mile)",
tickFormat: Math.round,
legend: true
},
marks: [
Plot.geo(stateShapes, {
stroke: "black",
fill: (s) => state_to_density.get(s.properties.name),
title: (s) =>
`${s.properties.name}: ${state_to_density.get(s.properties.name)}`
})
]
})
Insert cell
Insert cell
// Import the prefab geographic data from another notebook.
import { stateShapes } from "@observablehq/us-geographic-data"
Insert cell
// This defines a Javascript Map object that associates population densities with state names
state_to_density = d3.rollup(
state_pops,
(a) => a[0].rpopden,
(s) => s.GeoID_Name
)
Insert cell
// State population density comes from Policy Map and
// is uploaded as a File Attachment.
state_pops = FileAttachment("PolicyMap Data 2023-05-22 155049 UTC.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