Source | Documentation | Examples
Many map visualizations that use color as a dimension are misleading.
Social data is often put on a map (a choropleth), and colored to show some activity or behavior. The problem is that the data is often about people, but to the reader’s eye, maps are inherently about area. The biggest areas on the map get the reader’s attention, ignoring how many people in the data relate to that area. That’s okay if that data you are showing happens to be normalized by area — such as population density — but often this isn’t the goal of our visualizations.
Sometimes a cartogram is a better choice, but most cartograms are either skewed beyond recognition, or highly manual to create. Therefore, I’ve created a Python package to automatically scale the parts of any map by any variable, without any overlapping shapes and with minimal distortion.
Introducing mapscaler! All you need is a GeoPandas DataFrame, including one column that has values by which to scale each polygon. mapscaler will do the heavy lifting from there — scaling each polygon to the appropriate size, then rearranging them (minimally) until they don’t overlap.
<p>CODE: https://gist.github.com/conditg/44fee3dc943aaad799383257237d502c.js</p>
Dependencies:
<p>CODE: https://gist.github.com/conditg/0069fed75b231853ae70574adabed5d9.js</p>
For more info: