Search code examples
pythonmapsgeopandaspysal

How to plot two maps side by side using pysal or geopandas?


I want to plot two tematic maps side by side to compare then. I am using geopandas to plot the maps and pysal to generate the maps from spatial analysis.


Solution

  • You can create the subplots structure with matplotlib, and then add the plots with geopandas/pysal to the specific subplot:

    import matplotlib.pyplot as plt
    
    fig, axes = plt.subplots(ncols=2)
    # add geopandas plot to left subplot
    geodataframe.plot(..., ax=axes[0])
    # add pysal plot to right subplot using `axes[1]`