Civis R&D Bookshelf: Python & R Graph Libraries and Visualizing Population Distribution

by Michael Heilman

Civis Analytics
The Civis Journal
Published in
2 min readJan 19, 2018

--

xkcd Map

Choropleth maps are a powerful tool for visualizing data about the behavior of folks in America, but it’s difficult to make a good map because people aren’t evenly distributed across the country. Almost all of the land area of America is rural, but only about 20% of the people live in rural areas. This means that choropleth maps that color areas according to statistics about the people living there can vastly overrepresent rural areas. As discussed in this tweet thread, there are various ways to try to address this issue, such as deforming the shapes of states so that their sizes are proportional to their populations, but none of those seem as satisfying as the approach taken by the esteemed Randall Munroe for the map linked above. Though no visualization is perfect, this one (a) gives areas visual prominence based on population, (b) keeps states in their familiar shapes, © and only uses two scales (color, position). I’d love to have an easy-to-use Python or R package for this kind of map.

The Python Graph Library and The R Graph Library

Writing code often involves Googling for stackoverflow questions, blog posts, and adapting code snippets for one’s problem. This process can be more difficult when one has to write code for a visualization because finding the right keywords can be difficult. Galleries are often super-useful, and most visualization tools have one (e.g., for pandas, matplotlib, d3, ggplot2 extensions, vega-lite). The two sites linked above are nice because they provide galleries that include examples from multiple tools in their respective programming languages.

This post is part of our Bookshelf series organized by the Data Science R&D department at Civis Analytics. In this series, Civis data scientists share links to interesting software tools, blog posts, scientific articles, and other things that they have read about recently, along with a little commentary about why these things are worth checking out. Are you reading anything interesting? We’d love to hear from you on Twitter.

--

--