From b8a849c797b9e7e9b474c45353f1f1c031aa5091 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sun, 8 Oct 2023 19:21:11 +0200 Subject: crosssection --- test/cross.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/cross.py b/test/cross.py index 0dbb8c0..de6b9be 100755 --- a/test/cross.py +++ b/test/cross.py @@ -15,8 +15,12 @@ print(data) fig, ax = plt.subplots(figsize=(5, 5)) #clc = ax.plot(data.step.values.astype('float64'), data.isobaricInhPa, data.ccl.transpose()) -clc = ax.imshow(data.ccl.transpose(), extent=(data.step.values.astype(float).min(), data.step.values.astype(float).max(), data.isobaricInhPa.min(), data.isobaricInhPa.max()), aspect='auto', cmap='Blues_r', vmin=0, vmax=100) -plt.colorbar(clc, label='clcov') +#clc = ax.imshow(data.ccl.transpose(), extent=(data.step.values.astype(float).min(), data.step.values.astype(float).max(), data.isobaricInhPa.min(), data.isobaricInhPa.max()), aspect='auto', cmap='Blues_r', vmin=0, vmax=100) +#plt.colorbar(clc, label='clcov') +clc = ax.contourf(data.step.values.astype('float64'), data.isobaricInhPa, data.ccl.transpose(), cmap='Blues_r', vmin=0, vmax=100, levels=9) + +# use Format parameter for n/8 +plt.colorbar(clc, label='clcov', extendfrac=None, ticks=[100*n/8 for n in range(9)], format=lambda x,_: f'{int(x/12.5)}/8') cf = ax.contour(data.step.values.astype('float64'), data.isobaricInhPa, data.t.metpy.convert_units('degC').transpose()) -- cgit v1.2.3