Afrika-Karte mit Cartopy zeichnen

English Deutsch

Man kann einfach eine Afrika-Karte mit Cartopy zeichnen, indem die Ausdehnung auf [-23, 55, -35, 40] gesetzt wird:

how-to-draw-africa-map-using-cartopy.py
ax.set_extent([-23, 55, -35, 40])

Afrika-Karte, gezeichnet mit Cartopy using PlateCarree projection

Vollständiger Beispielcode

Der obige Code erzeugt das oben gezeigte Bild:

africa_cartopy_complete.py
import cartopy.crs as ccrs
import cartopy.feature as cf
from matplotlib import pyplot as plt

proj = ccrs.PlateCarree()
ax = plt.axes(projection=proj)
ax.set_extent([-23, 55, -35, 40])
ax.stock_img()

ax.add_feature(cf.COASTLINE, lw=2)
ax.add_feature(cf.BORDERS)
# Abbildung vergrößern
plt.gcf().set_size_inches(20, 10)

# Abbildung als SVG speichern
plt.savefig("Africa.svg")

Check out similar posts by category: Cartopy, Geography, Python