Hi everyone,
I often find that quantile-based scales work better than linear ones when visualizing choropleth map data. (After all, particularly high or low values can easily skew a linear range.)
Therefore, I put together a county population-growth dashboard that allows growth rates to be viewed in either percentile-based or quantile-based form. The dashboard also lets users determine the starting and ending years for population growth calculations and set a minimum population size; the dashboard’s JavaScript code will then calculate new colorscales accordingly.
The dashboard also shows how to use Plotly’s hovertemplate argument, together with its customdata argument, to create custom tooltips that show data both from the map’s underlying GeoJSON data and the population-growth table that it imports.
Although I’ve enjoyed using Danfo.js for underlying data manipulation, that library hasn’t been updated in a little while, so I used d3-array for certain data-related tasks instead.
To view the project’s underlying code and see how the data was retrieved, feel free to visit its GitHub repository. All content has been made available under the MIT license (though the underlying datasets, which come from the US Census, are in the public domain).
Here are a few screenshots:
- Default view:
2. Filtered view showing only counties with 100K+ residents in 2024: (Note that the colorscale got updated to reflect this filtered dataset.)
-
Linear scale: (Note how a few outliers caused the scale to become much more muted)
I hope you find this project’s code useful in your own work!





