I've been studying bits and pieces of D3.js for the past few weeks. Although I've struggled with data binding in the data-driven nature of the framework, the library comes with a large number of interesting features like support for Voronoi diagrams and dozens of geographical projections.
The creator of the library, Mike Bostock, has made a mind-boggling number of examples available on http://bl.ocks.org/, and there's also a text by Scott Murray that O'Reilly makes available for free online.
Since it's almost Thanksgiving, I thought I'd try making some choropleths about turkey production and consumption in the US. As it turns out, this is fairly straightforward using D3: download some free SVGs of blank maps from Wikimedia Commons; find the relevant US Census and USDA data to create CSV files; and link up the two with a few lines of code.
- Top = turkey production by state in 2010[1]. Minnesota and North Carolina produce by far the most turkeys, with a combined total of over 2 billion pounds.
- Bottom = per capita meat consumption by county in 2011[2]. The relative uniformity of the data isn't surprising, but I wouldn't have guessed the pockets of above-average consumption in the Northeast and California (perhaps a positive correlation with income?).
[1] U.S. Census Bureau, Statistical Abstract of the United States: 2012.
[2] USDA, Food Environment Atlas Data, 2011. This was the closest proxy I could find to turkey consumption. No data available for Alaska and Hawaii.