Choropleth map
A choropleth map displays divided geographical areas or regions that are coloured in relation to a numeric variable. This section explains how to build static choropleth with geopandas and geoplot, and interactive versions with tools like folium and plotly.
Choropleth map with Geopandas and GeoPlot
Geoplot is a python library for geospatial data visualization. It works pretty well with geopandas, another library made to deal with geospatial data objects.
Geoplot has a choropleth() function that allows to build a choropleth map easily as shown in the example below.
Choropleth map of US counties with Python, Geopandas and Geoplot
Folium for google maps style choropleth maps
Folium is a wrapper of the Leaflet.js javascript library. It brings the power of javascript for data visualization, but still allows to do some data wrangling with Python. Building a choropleth with Folium is quite straightforward thanks to the choropleth() function.
Plotly for interactive choropleth maps
Plotly is a powerful library for interactive data visualization. It allows to build choropleth maps with the choropleth() function.
Try to hover the map below to see the value of each country. You can also zoom in and out, and move the map around.
See codeMatplotlib for static choropleth maps
Matplotlib allows to build static choropleth maps with the geopandas library. The below example shows how to build a choropleth map of European countries with geopandas and matplotlib.
Combine multiple maps together, with a lollipop plot for the legend
Choropleth map of European counties with Matplotlib and Geopandas
Choropleth map with customized legend, using Matplotlib and Geopandas
Choropleth map combined with a barplot
Two choropleth maps with different granularities
Choropleth map combined with a barplot for the legend
Choropleth map combined with a histogram for the legend
Beyond the choropleth: a polygon map
💡 Out of dataviz inspiration?
I have spent years collecting the most beautiful data visualizations out there. Get the list of my top 300 dataviz projects, hand-picked, for free.
I respect your privacy. Unsubscribe anytime.