[GIS] Plotting polygons as separate plots using Python

plotpolygonpythonshapefile

I have a shapefile with several polygons in a geodataframe. I want to plot each individual polygon in their own plot.

I tried

for pol in z3:
  plt.figure()
  plt.plot(pol)
  plt.show()

But this just loops through the columns of the data frame.

Best Answer

import geopandas as gpd
import matplotlib.pyplot as plt

gdf = gpd.read_file("path/to/shapefile.shp")

for row in gdf.iterrows():    
    geom = gpd.GeoSeries(row[1].geometry)
    geom.plot()

enter image description here

enter image description here