I was mapping a rate per county and the first output used Web Mercator, which visually inflates the northern counties and makes the whole map misleading for anything area-related. It also binned the data into equal-width buckets so 90% of counties fell in one color.
The fix was pinning the projection to Albers USA and forcing a quantile or Jenks classification with a clearly labeled legend, including an explicit color for 'no data'. Suddenly the map told the truth.
Does anyone have a good prompt pattern for making it choose between quantile and Jenks based on the distribution instead of me deciding?
Build a US county choropleth with D3 v7 and TopoJSON. Non-negotiables:
Projection: geoAlbersUsa (handles AK/HI insets), never Web Mercator for area-based data. Fit the projection to the container, no hardcoded scale.
Data join: join by 5-digit FIPS as a string (pad leading zeros; a common bug is FIPS 01001 read as 1001). Report how many map features found no data row and how many data rows matched no feature.
Classification: given a values array, pick a scheme by rule - if the distribution is roughly log-normal or highly skewed (|skew| > 1) use quantile (7 classes), else use equal-interval; state which and why. Use a single-hue sequential scheme (ColorBrewer) generated to be colorblind-safe.
Legend: a discrete swatch legend with the actual bin edges as labels (e.g. '12.4 - 18.9'), plus a distinct hatched swatch for 'no data'. Never a continuous gradient bar for a binned map.
Interaction: hover shows county name + raw value + which bin; mobile falls back to tap. Add a one-line caption stating the projection and classification so the map is self-documenting. One HTML file.