我的数据是 -100o - 30o lon 和 0o - 80o lat。
我想使用投影来仅显示该区域。
在我的脑海中,我想展示这样的情节:
但是,当我尝试 AlbersEqualArea 投影时,如下所示:
plt.figure(figsize=(5.12985642927, 3))
ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=-35, central_latitude=40, standard_parallels=(0, 80)))
ax.set_extent([lon180[0], lon180[-1], lat[0], lat[-1]], ccrs.Geodetic())
我得到一张地图,显示:
如何显示我拥有数据的区域?
如果你想要一个非矩形边界,你必须自己定义它。像下面这样的东西可能对你有用:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import matplotlib.path as mpath
proj = ccrs.AlbersEqualArea(central_longitude=-35,
central_latitude=40,
standard_parallels=(0, 80))
ax = plt.axes(projection=proj)
ax.set_extent([-100, 30, 0, 80], crs=ccrs.PlateCarree())
ax.coastlines()
# Make a boundary path in PlateCarree projection, I choose to start in
# the bottom left and go round anticlockwise, creating a boundary point
# every 1 degree so that the result is smooth:
vertices = [(lon, 0) for lon in range(-100, 31, 1)] + \
[(lon, 80) for lon in range(30, -101, -1)]
boundary = mpath.Path(vertices)
ax.set_boundary(boundary, transform=ccrs.PlateCarree())
plt.show()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)