Geographical plotting
To demonstrate the power of Matplotlib with third-party packages, we will illustrate its usage in spatial analysis. Since the invention of satellites, a myriad of useful Geographics Information System (GIS) data has been generated to facilitate various analyses, from natural phenomena to human activities.
To utilize this data, there are common Python packages integrated with Matplotlib to show spatial data on a map, such as Basemap, GeoPandas, Cartopy, and Descartes. In this final section of the chapter, we will briefly introduce the usage of the first two packages.
Basemap
Basemap is among the most popular Matplotlib-based plotting toolkits to plot over world maps. It is a handy way to show any geographical location.
To install Basemap, do this:
- Unpack in
$Python3_dir/site-packages/mpl_toolkits
- Enter the Basemap installation directory:
cd $basemap_dir
- Enter the
geos
directory in theBasemap
directory:cd $basemap/geos-3.3.3
- Install the GEOS library via
./configure
,make
, and...