Public
Edited
Apr 7
Importers
Insert cell
Insert cell
nhgis0003_ds54_1930_state.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
import { us } from "@observablehq/us-geographic-data"
Insert cell
states = topojson.feature(us, us.objects.states)
Insert cell
nation = topojson.feature(us, us.objects.nation)
Insert cell
literacy = FileAttachment("nhgis0003_ds54_1930_state.csv").csv({ typed: true })
Insert cell
literacy
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
literacyLookup = {
const k = "STATE";
const v = "BDV001";
return new Map(literacy.map((x) => [x[k], +x[v]]));
}
Insert cell
literacyLookup.get("New York")
Insert cell
Insert cell
nhgis0004_ds224_1930_state.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
literacyAQ = aq.from(literacy)
Insert cell
totalAQ = aq.from(total1930)
Insert cell
literacyJoined = literacyAQ.join_left(totalAQ, "GISJOIN")
Insert cell
lj = literacyJoined.objects ()
Insert cell
normalliteracyLookup = {
const k = "STATE_1";
const v = "BDV001";
const c = "AF14001"
return new Map(lj.map((x) => [x[k], +x[v]/x[c]]));
}
Insert cell
normalliteracyLookup.get("Texas")
Insert cell
Plot.plot({
projection: "albers-usa",
color: {
type: "sequential",
scheme: "Reds",
legend: true
},
title: "Illiteracy per capita 1930",
marks: [
Plot.geo(states, {
fill: (d) => normalliteracyLookup.get(d.properties.name),
stroke: "black"
}),
Plot.geo(nation, { stroke: "black" })
]
})
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