使用lon和

2024-09-26 18:20:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我的数据是-100o-30o lon和0o-80o lat

我想用投影只显示这个区域。在

在我的脑海里,我想展示这样一个情节:

{1美元^

但是,当我尝试如下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())

我有一张地图显示:

regional AEA map

显示我有数据的区域的最佳方法是什么?在

干杯, 雷


Tags: 数据区域pltax投影figurecentrallon
2条回答

如果你想要一个非矩形的边界,你必须自己定义它。以下内容可能对您有用:

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()

enter image description here

我想也许你需要添加AlbersEqualArea作为图的变换,也许更像this。在

相关问题 更多 >

    热门问题