Introduction to Map Plotting with GeoPandas

Explore the basics of GeoPandas visualization capabilities.

Introduction

Plotting with GeoPandas is based on the Matplotlib library. Matplotlib provides a wide variety of visualization options, and by using it as a foundation, GeoPandas can create intricate maps with relative ease. The relationship between GeoPandas and Matplotlib is symbiotic: GeoPandas handles the geospatial data manipulation (i.e., coordinates, projections, etc.) and Matplotlib handles the actual plotting.

Although Matplotlib provides the foundation for plot rendering, other packages are used in the process. For example, the conversion from Shapely geometries, which are actually stored in a GeoDataFrame, to Matplotlib paths (disconnected segments) and patches (closed 2-D shapes with defined facecolor) is provided by the Descartes package. Moreover, mapclassify is used for the optimal classification of numerical values to create choropleth maps.

These packages are fundamental and they are accessed directly by GeoPandas, being transparent to the user. Besides those, there are other packages that can be used for interactive plotting (e.g., Folium), to overlay raster imagery (e.g., Contextily), or to serve as a higher-level plotting API such as Geoplot. The following figure brings two examples of plots created with Geoplot and Contextily respectively. The Geoplot library was used in the left figure to plot the countries on an Ortographic projection, while Contextily was used in the right figure to plot to include a raster of rain anomaly over a specific basin.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy