Published
Edited
Mar 4, 2022
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// where 80% of counties fall into
d3.rollup(
joined
.filter((d) => d.designation)
.filter((d) => d.ratio_without >= 0.11 && d.ratio_without < 0.333333),
(v) => v.length,
(d) => d.designation
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// beeswarmChartUrban
Insert cell
// beeswarmChartRural
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
format = d3.format(".3f")
Insert cell
Insert cell
sortedWith = data
.map((d) => d.ratio_with)
.filter((d) => d !== null && !isNaN(d))
.sort(d3.ascending)
Insert cell
sortedWithout = data
.map((d) => d.ratio_without)
.filter((d) => d !== null && !isNaN(d))
.sort(d3.ascending)
Insert cell
Insert cell
data.length
Insert cell
urban.length + rural.length
Insert cell
urban = joined.filter((d) => d.designation === "urban")
Insert cell
rural = joined.filter((d) => d.designation === "rural")
Insert cell
joined = {
const urbanRuralLookup = new Map(
designationUrbanRural.map(({ geoid, pct_rural_2010 }) => [
geoid,
pct_rural_2010 >= 50 ? "rural" : "urban"
])
);

return data.map((d) => {
const designation = urbanRuralLookup.get(d.fips);
return {
...d,
designation
};
});
}
Insert cell
data
Insert cell
fipsToCounty = new Map(data.map(({ fips, name }) => [fips, name]))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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