Skip to main content
100%

Population Choropleth

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 23, 2013

A population choropleth of U.S. counties uses a logarithmic color scale to show population density, ranging from pale yellow to dark blue. The map projects counties with d3.geo.albersUsa() and renders them as SVG paths via d3.geo.path. Density is calculated by dividing each county’s population (from the 2010 Census shapefile, converted to TopoJSON) by its projected area, with the color domain set between the 1st and 99th percentiles. The topojson.feature API extracts county geometries for display.

AI-generated description

Note: the counties aren’t clipped to water boundaries, so they look a bit weird and the corresponding density calculation is inaccurate. So don’t copy this example without fixing those problems first, ok? See the us-atlas project for a more comprehensive Makefile of examples, and the projected choropleth example for a better style. Also, you’ll want to add a legend for the color scale.

To build this example, git clone this repo, npm install, and then make.

gpl-3.0 Licensed

Similar vizzes