File size: 687 Bytes
2ac7da0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import matplotlib.pyplot as plt
import geopandas as gpd
# all plotting functions
def create_plot(filename, extent, *gdfs): # takes in unlimited number of gdfs
fig, ax = plt.subplots(figsize=(10, 8)) #Sets image size by width & height (in inches)
colors = ['tan', 'mediumseagreen', 'thistle', 'lightcoral', 'sienna', 'yellow'] # Extend/improve this list as needed
for idx, gdf in enumerate(gdfs):
gdf.plot(ax=ax, color=colors[idx % len(colors)]) # Cycle through colors
ax.set_xlim(extent[0], extent[2])
ax.set_ylim(extent[1], extent[3])
# Hide axes
ax.axis('off')
plt.savefig(filename, bbox_inches='tight', pad_inches=0) # remove padding |