Background Map

logo of a chart:Map

The first step of any geo-spatial data analysis is to draw the background map of the area of interest. This section explains what are the main ways to build it with Python. It is the foundation of the next sections that will add some data on top of it.

GeoPlot & Cartopy

GeoPlot is an extension of Cartopy and Matplotlib to create maps with minimal efforts.

When creating maps, there are a large number of possible projections. The article below explains how to modify them.

Change projection in maps

Change projection in maps

Folium for google maps style maps

Folium is a wrapper of the leaflet.js javascript library. It allows to make all the data wrangling with python, and benefit the power of javascript for interactive data visualization.

The map below has been created with folium... with 1 line of code only! 😍



Folium allows different types of background tiles. Here is an example with a tile called Cartodb Dark Matter:



It is also possible to add markers with associated popups on top of the map:

Background map with Basemap

Seaborn is another great alternative to build an area chart with python. The below examples show how to start basic, apply usual customization, and use the small multiple technique for when you have several groups to compare.

Contact


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥