测试环境:
anaconda3+python3.11
cartopy==0.23.0
测试代码:
# 导入所需的库
import matplotlib as mpl
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
# 创建画布以及ax
fig = plt.figure()
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
# 调用ax的方法画海岸线
ax.coastlines()
plt.show()
测试结果: