Matplotlib Basemap:如何使绘图轴/边界为非矩形?

时间:2019-05-17 12:14:05

标签: python matplotlib terminology matplotlib-basemap map-projections

我相信我的问题在某种程度上与术语或预测有关。我向您道歉,因为我的问题似乎很愚蠢,但我在网上没有找到任何教程。

我正在使用底图在欧洲和北大西洋上绘制地势高度。到目前为止,我设法获得了这样的东西:

Geopotential

基本上,我使用的是底图示例的修改后的代码片段:

def plot_EuropeNAO_Lambert(lons, lats, dx:float=2e4, dy:float=2e4,  ax=None):
# If ax is not specified, create a new figure
if ax is None:
        fig, ax = plt.subplots()

# Compute center of the map
lon_0 = lons.mean()
lat_0 = lats.mean()

# Compute the number of latitures and longitudes 
nlat = np.squeeze(lats).size
nlon = np.squeeze(lons).size
print(f"nlon={nlon} and nlats={nlat}")

# setup lambert conformal basemap.
# lat_1 is first standard parallel.
# lat_2 is second standard parallel (defaults to lat_1).
# lon_0,lat_0 is central point.
# rsphere=(6378137.00,6356752.3142) specifies WGS84 ellipsoid
# area_thresh=1000 means don't plot coastline features less
# than 1000 km^2 in area.
m = Basemap(width=nlon * dx, height=nlat * dy,
        rsphere=(6378137.00,6356752.3142),\
        resolution='l',area_thresh=1000.,projection='lcc',\
        lat_1=30.,lat_2=70,lat_0=lat_0,lon_0=lon_0, ax=ax)

m.drawcoastlines()
# draw parallels and meridians.
m.drawparallels(np.arange(-80.,81.,20.))
m.drawmeridians(np.arange(-180.,181.,20.))
return m

但是我希望我的坐标轴尽可能地遵循计算我的值的域,例如这张图片:

enter image description here

我使用了错误的投影吗?

无论如何,任何帮助将不胜感激!

0 个答案:

没有答案