import matplotlib.pyplot as plt

clamp = lambda y: min(abs(y), 32.2)
a_b = lambda d: -5.1115922342571294e-6*d**3 + 0.00029499040079464792*d**2 - 0.003330761720380433*d + 0.0066855943526305008

delta = 0.1
dmax = 40
d = [i*delta for i in range(int(dmax/delta)+1)]
fig, ax = plt.subplots()
ax.axhline(color='grey', lw=1, linestyle='dotted')
ax.plot(d, [a_b(clamp(dd)) for dd in d])
ax.set_ylabel('a - b')
ax.set_xlabel('depth [km]')
ax.set_box_aspect(0.33)
plt.show()