我正在尝试将 shapefile 布局添加到 xarray 分面图的子图中。现在,它正在将其绘制在两个单独的图中,但我希望布局出现在 13 个子图的每一个上。
这是我使用过的代码:
pft = xarray.open_dataset("/home/clara/rahu_data/netcdf/jules_frac_9pft_2015_ESA_rahu.nc")
pft['frac'].loc[13,:,:]
pft = pft['frac']
f, ax = plt.subplots(figsize=(10,5))
pft.plot(x="lon", y="lat", col="type", col_wrap=5)
shpfile.plot(ax=ax, facecolor="none")
我正在尝试将 shapefile 布局添加到 xarray 分面图的子图中。现在,它正在将其绘制在两个单独的图中,但我希望布局出现在 13 个子图的每一个上。
这是我使用过的代码:
pft = xarray.open_dataset("/home/clara/rahu_data/netcdf/jules_frac_9pft_2015_ESA_rahu.nc")
pft['frac'].loc[13,:,:]
pft = pft['frac']
f, ax = plt.subplots(figsize=(10,5))
pft.plot(x="lon", y="lat", col="type", col_wrap=5)
shpfile.plot(ax=ax, facecolor="none")
在阅读 cartopy 世界中的 shapefile 后我知道该怎么做了。
你可以尝试这样的事情:
a=pft.plot(x="lon", y="lat", col="type", col_wrap=5)
[a.axs.flatten() 中的 ax.add_feature(shpfile,zorder=1)]