I want to produce a plot of the canton of Zürich by by importing a shapefile of Switzerland (https://www.swisstopo.admin.ch/de/geodata/landscape/boundaries3d.html) and zoom into the area of interest. In the last step I want to save the produced image as .eps file. The problem is that the save image file is empty.
First the packages geopandas and matplotlib are imported
import geopandas
import matplotlib.pyplot as plt
Then the data of the shapefile is loaded
gdf = geopandas.read_file("swissBOUNDARIES3D_1_3_TLM_KANTONSGEBIET.shp")
Then the map of Switzerland is plotted. The canton of Zürich is colored different than all other cantons. After this, a zoom onto the canton of Zürich is done.
fig = plt.figure(figsize=(30, 18))
ax2 = gdf.plot(figsize=(30,18), edgecolor='black')
gdf[gdf.NAME == "Zürich"].plot(edgecolor='black', color='lightskyblue', ax=ax2)
gdf[gdf.NAME != "Zürich"].plot(edgecolor='black', color='aliceblue', ax=ax2)
plt.xlim(650000,750000)
plt.ylim(220000,290000)
The produced image should then be saved.
fig.savefig("filename2.eps", format='eps')
plt.show()
But the generated image is empty. It is also empty when the format is changed to png.