Public
Edited
Apr 7
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

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