how to plot a graph using cartopy code example
Example: season plot with cartopy in python
import matplotlib.pyplot as plt
plt.style.use(['seaborn-talk', 'seaborn-ticks'])
import xbpch
ds = xbpch.open_bpchdataset(
"/Users/daniel/workspace/bpch/test_data/ref_e2006_m2008.bpch",
diaginfo_file="/Users/daniel/Desktop/sample_nd49/diaginfo.dat",
tracerinfo_file="/Users/daniel/Desktop/sample_nd49/tracerinfo.dat",
dask=True, memmap=True
)
seasonal_o3 = (
ds['IJ_AVG_S_O3']
.isel(lev=0)
.groupby('time.season').mean('time')
)
print(seasonal_o3)
import cartopy.crs as ccrs
g = seasonal_o3.plot.imshow(
x='lon', y='lat',
vmin=0, vmax=60., cmap='gist_stern',
col='season', col_wrap=2,
transform=ccrs.PlateCarree(),
subplot_kws=dict(projection=ccrs.PlateCarree())
)
for ax in g.axes.ravel():
ax.coastlines()
plt.show()