Published
Edited
Nov 9, 2020
2 stars
Insert cell
Insert cell
aq.from(counties).orderby(aq.desc("statePercent")).view()
Insert cell
Insert cell
aq.from(counties).orderby(aq.desc("population")).view()
Insert cell
counties = countyShapes.features.map(d => {
let stateFips = d.id.slice(0,2)
let pop = populationByCounty.get(d.id)
let statePop = populationsByState.get(stateFips)
return {
name: d.properties.name,
stateName: statesById.get(stateFips).properties.name,
statePercent: pop/statePop * 100,
population: pop,
fips: d.id,
stateFips: stateFips,
}
})
Insert cell
import {countyShapes, populationByCounty, stateShapes} from "@enjalot/us-county-datasets"
Insert cell
populationByCounty
Insert cell
countyShapes
Insert cell
countiesByState = d3.group(countyShapes.features, d => d.id.slice(0,2))
Insert cell
populationsByState = d3.rollup(countyShapes.features, v => d3.sum(v, d => populationByCounty.get(d.id)), d => d.id.slice(0,2))
Insert cell
statesById = new Map(stateShapes.features.map(d => [d.id, d]))
Insert cell
counties.filter(d => d.statePercent > 50)
Insert cell
d3 = require("d3")
Insert cell
import { aq, op } from '@uwdata/arquero'
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