Map visualizations are an effective way to gain insights from geo-spatial data. In a previous post we looked at rental bike data in Cologne. For that, we used the
Basemap extension for
Matplotlib. However, using Matplotlib often feels cumbersome and the output is static. Moreover, the charts look kind of outdated. In a follow up post we dealt with these issues by introducing
bokeh as an alternative. The result was a good looking visualization with lots of interactivity.
However, when thinking about visualization libraries in Python the whole landscape is way wider:
"[...] [steers] users to a smaller number of starting points without cutting them off from important functionality [...]".
One of the results of the initiative is the GeoViews library:
GeoViews is a Python library that makes it easy to explore and visualize geographical, meteorological, and oceanographic datasets, such as those used in weather, climate, and remote sensing research.
It is very high-level so that you can do great things in only a few lines of code. Moreover, it builds upon bokeh so that you have interactivity. Lastly, it shares a consistent and simple syntax with all other PyViz libraries.
In the following, we will again use our Cologne bike rental data to demonstrate the elegance of GeoViews. We will dive into using shapefiles, plotting geo locations and adding several levels of interactivity. Get the data here and follow along.
As usual, we start by importing the relevant libraries. Also, we tell
GeoViews to use
bokeh for chart outputs and display these inside our notebook:
# coding: utf-8 import pandas as pd import numpy as np import geoviews as gv #from bokeh.io import output_notebook #output_notebook() pd.set_option('display.max_columns', 100) gv.extension('bokeh')