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