T-S plotting exercise

In [1]:
import gsw
import numpy as np


s = np.arange(30, 38)
t = np.arange(0, 13)

S, T = np.meshgrid(s, t)

sigma = gsw.sigma0(S, T)
In [2]:
%matplotlib inline
import matplotlib.pyplot as plt


fig, ax = plt.subplots(figsize=(7, 7))
cs = plt.contour(S, T, sigma, [24], colors='k')
label, = plt.clabel(cs)
label.set_text(r'$\sigma_t=24$')

ax.set_xticks(s)
ax.set_yticks(t)
ax.grid()
fig.tight_layout()
ax.set_ylabel(r'Temperature ($^\circ$C)')
ax.set_xlabel(u'Salinity (‰)')
ax.xaxis.tick_top()
ax.xaxis.set_label_position('top')
ax.text(30, 0, '24.10')
ax.text(31, 0, '24.91')
ax.text(32, 0, '25.71')
ax.text(33, 0, '26.52')
ax.text(34, 0, '27.32')
ax.text(35, 0, '28.13')
ax.text(36, 0, '28.93')
<matplotlib.text.Text at 0x7fc53a76ea20>

png