I have attempted to achieve this following the code provided at the end of this page. What I have tried is the following:
fig, (ax1, ax2) = plt.subplots(1,2, figsize=(24, 10))
fig.suptitle('Comparison of 1970-2000 and 2070-2100 Soil Moisture Content')
ax1 = plt.axes(projection=ccrs.PlateCarree())
ax1.set_title('Under SSP245 Scenario')
cf1 = ax1.contourf(lon_hist, lat_hist, mrsos_change45, transform=ccrs.PlateCarree(), cmap='BrBG')
fig.colorbar(cf1, ax=ax1)
ax1.set_aspect('equal', adjustable=None)
ax1.add_feature(ctp.feature.BORDERS, linestyle='-', alpha=1)
ax1.coastlines(resolution='10m')
ax1.add_feature(ctp.feature.OCEAN, zorder=100, edgecolor='k')
ax1.coastlines()
ax1.gridlines(draw_labels=True)
ax2 = plt.axes(projection=ccrs.PlateCarree())
ax2.set_title('Under SSP585 Scenario')
cf2 = ax2.contourf(lon_hist, lat_hist, mrsos_change85, cf1.levels, transform=ccrs.PlateCarree(), cmap='BrBG')
fig.colorbar(cf2, ax=ax2)
ax2.set_aspect('equal')
ax2.add_feature(ctp.feature.BORDERS, linestyle='-', alpha=1)
ax2.coastlines(resolution='10m')
ax2.add_feature(ctp.feature.OCEAN, zorder=100, edgecolor='k')
ax2.coastlines()
ax2.gridlines(draw_labels=True)
plt.show()
But this only produces one the second of the two cartopy maps that I am trying to produce. Unfortunately, I am unable to provide the data I am using as it is very large data files. But can anyone see mistakes in the code that stops it from producing the first one?
plt.figure(figsize=(24,10));ax1 = plt.subplot(1,2,1, projection=ccrs.PlateCarree());ax2 = plt.subplot(1,2,2, projection=ccrs.PlateCarree())
– r-beginners