I have two GeoDataFrames. The first one have the administrative boundaries of the 25 regions of a country. The second one, the urban fabric of the same country.
regions.head()
COD NAMEREG ID geometry
0 06 CAJAMARCA 6 MULTIPOLYGON (((175543.152 9154323.287, 175542...
1 14 LAMBAYEQUE 14 MULTIPOLYGON (((148.362 9224534.960, 85.995 92...
2 15 LIMA 15 MULTIPOLYGON (((395740.367 8562514.992, 395702...
3 02 ANCASH 2 MULTIPOLYGON (((261823.737 8840350.284, 261826...
4 04 AREQUIPA 4 MULTIPOLYGON (((891245.832 8110391.639, 891267...
urbfab.head()
Area geometry
0 124196.0 MULTIPOLYGON (((1714054.886 9088365.957, 17143...
1 124196.0 MULTIPOLYGON (((1835848.391 9084645.865, 18361...
2 62098.0 MULTIPOLYGON (((1712843.236 9087713.270, 17131...
3 124196.0 MULTIPOLYGON (((1835363.081 9083054.193, 18356...
4 124196.0 MULTIPOLYGON (((1756044.734 9085140.825, 17563...
So, to plot both of them I use this code:
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(16, 16))
regions.plot(ax=ax, color='#ffffff', edgecolor='#6a6a6a', linewidth=2)
urbfab.plot(ax=ax, color='#000000', edgecolor='#000000')
_=ax.axis('off')
Which results in this image, which for basic purposes is OK:
But I want to know if is it possible to get an image like this, where any region is shown separately.
(Of course, this is for example purposes only, that is why I plotted only 3 regions. It was produced in QGIS)