import xarray as xr
import cartopy.crs as ccrs
USA_PROJ = ccrs.AlbersEqualArea(central_longitude=-97., central_latitude=38.)
g_simple = ds_by_month.t2m.plot(x='longitude',
y='latitude',
col='month',
col_wrap=6,
aspect=ds.dims['longitude'] / ds.dims['latitude'],
subplot_kws=dict(projection=USA_PROJ),
add_colorbar=False,
transform=ccrs.PlateCarree())
g_simple.add_colorbar(orientation='horizontal')
for ax in g_simple.axes.ravel():
ax.coastlines()
ax.set_extent([-121, -72, 22.5, 50])
plt.tight_layout()
plt.show()
如何确保颜色条不与图重叠?即使我使用 xarray 默认颜色栏,也会发生重叠。