Originally published on my old blog, April 2017.
Thanks to cartogram.js, a JavaScript implementation of an algorithm to construct continuous area cartograms, by James A. Dougenik, Nicholas R. Chrisman and Duane R. Niemeyer, ©1985 by the Association of American Geographers.
Cartogram.js is designed and built by Shawn Allen at Stamen and has a home on Github. It runs with topoJSON files and d3.js by Mike Bostock.
This example runs with d3.v2, an older version.
It's based on a tutorial from Jeff Fletcher on his South Africa dataviz blog, Limn. He bundles up the appropriate versions of cartogram, topojson and d3 here.
And in my own Github repo, here's how I knitted all this together.
Data source: Population estimate for July, 2016 from the U.S. Census, downloaded April 25, 2017.