aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-08 19:21:11 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-08 19:21:11 +0200
commitb8a849c797b9e7e9b474c45353f1f1c031aa5091 (patch)
treec372895cd49cc13deb9de13056c60b1492495b62
parent880fdafc90626c181c1e37828f929cf247af9766 (diff)
downloadmeteo_toolbox-b8a849c797b9e7e9b474c45353f1f1c031aa5091.tar.gz
crosssection
-rwxr-xr-xtest/cross.py8
1 files changed, 6 insertions, 2 deletions
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())