我有一些我想用Cartopy显示的卫星图像数据.我已成功按照图像示例详细介绍了here.导致此代码:
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
fig = plt.figure(figsize=(12,12))
img_extent = (-77,-59,9,26)
ax = plt.axes(projection=ccrs.PlateCarree())
# image data coming from server,code not shown
ax.imshow(img,origin='upper',extent=img_extent)
ax.set_xmargin(0.05)
ax.set_ymargin(0.10)
# mark a known place to help us geo-locate ourselves
ax.plot(-117.1625,32.715,'bo',markersize=7)
ax.text(-117,33,'San Diego')
ax.coastlines()
ax.gridlines()
plt.show()
此代码生成以下图像
我的问题是卫星图像数据不在PlateCarree投影中,而是墨卡托投影.
但是当我得到轴对象时
ax = plt.axes(projection=ccrs.Mercator())
我失去了海岸线.
我看到了here报告的问题.但是
ax.set_global()