如何使用 Cartopy 绘制欧洲地图
我们可以通过将范围设置为 [-13, 45, 30, 70] 轻松使用 Cartopy 绘制欧洲地图:
how-to-draw-europe-map-using-cartopy.py
ax.set_extent([-13, 45, 30, 70])完整代码示例
上面的代码生成上面显示的图像:
europe_cartopy_complete.py
import cartopy.crs as ccrs
import cartopy.feature as cf
from matplotlib import pyplot as plt
proj = ccrs.Miller()
ax = plt.axes(projection=proj)
ax.set_extent([-13, 45, 30, 70])
ax.stock_img()
ax.add_feature(cf.COASTLINE, lw=2)
ax.add_feature(cf.BORDERS)
# 使图更大
plt.gcf().set_size_inches(20, 10)
# 将图保存为 SVG
plt.savefig("Europe.svg")If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow