Skip to content

Instantly share code, notes, and snippets.

@jbusecke
Last active October 29, 2020 15:20
Show Gist options
  • Save jbusecke/268044885f104ba33c13c8c940ff49d8 to your computer and use it in GitHub Desktop.
Save jbusecke/268044885f104ba33c13c8c940ff49d8 to your computer and use it in GitHub Desktop.
fig, axarr = plt.subplots(nrows=3, figsize=[10,12], sharex=True)
for ax, var, cmap in zip(
axarr.flat,
['thetao', 'so', 'cfc11'],
[cmo.thermal, cmo.haline, cmo.matter]
):
kwargs = dict(yincrease=False, x='lat', y='lev', ax=ax)
# Plot a section along the dateline in 1980 in the southern ocean
ds_section[var].plot.contourf(
levels=31, robust=True, cmap=cmap, **kwargs
)
# contour the density levels
ds_section.sigma_0.plot.contour(
levels=np.arange(24.2,29, 0.4), colors='w', **kwargs
)
ax.set_title('')
# add a bit more space between the panels
fig.subplots_adjust(hspace=0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment