Public
Edited
Apr 10, 2023
1 fork
Insert cell
Insert cell
Insert cell
url = "https://data.chnm.org/relcensus/city-membership?year=1926&denominationFamily=Episcopalian"
Insert cell
data = d3.json(url)
Insert cell
Insert cell
Insert cell
Wrangler(data)
Insert cell
Insert cell
Insert cell
dotplot = Plot.dot(data, {x: "population_1926", y: "members", stroke: "state"}).plot()
Insert cell
Insert cell
data_lutheran = d3.json("https://data.chnm.org/relcensus/city-membership?year=1926&denominationFamily=Lutheran")
Insert cell
combined = data_lutheran.concat(data)
Insert cell
combined
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
improvedPlot = Plot.plot({
grid: true,
// https://observablehq.com/@observablehq/plot-cheatsheets-layouts?collection=@observablehq/plot-cheatsheets
marginLeft: 60,
x: {
label: "Percentage of total population →",
tickFormat: ".0%",
},
y: {
label: "↑ City population in 1926",
type: "log",
},
marks: [
Plot.ruleX([0]),
Plot.dot(combined, {x: d => (d.members / d.population_1926),
y: "population_1926",
r: "churches",
stroke: "group"})
],
color: {
legend: true // add a legend
}
})
Insert cell
Insert cell
map = Plot.plot({
width: 960,
height: 600,
marginLeft: 0,
marginRight: 0,
projection: "albers",
color: {
legend: true,
label: "Denomination"
},
facet: { data: combined, x: "group"},
marks: [
Plot.geo(nation, { clip: "frame" }),
Plot.geo(statemesh, {strokeOpacity: 0.2, clip: "frame"}),
Plot.dot(combined, {x: "lon", y: "lat", stroke: "group", r: "churches"})

]
})
Insert cell
Insert cell
import {Wrangler, op} from "@observablehq/data-wrangler"
Insert cell
us = FileAttachment("us-counties-10m.json").json()
Insert cell
states = topojson.feature(us, us.objects.states)
Insert cell
statemesh = topojson.mesh(us, us.objects.states, (a, b) => a !== b)
Insert cell
nation = topojson.feature(us, us.objects.nation)
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