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

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