Skip to content

Commit 6752bad

Browse files
authored
Remove title from colorbar (#260)
And add units to its label instead
1 parent 10540d2 commit 6752bad

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pysteps/visualization/precipfields.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,11 @@ def plot_precip_field(
191191
cbar.ax.set_yticklabels(clevs_str)
192192

193193
if ptype == "intensity":
194-
cbar.ax.set_title(units, fontsize=10)
195-
cbar.set_label("Precipitation intensity")
194+
cbar.set_label(f"Precipitation intensity [{units}]")
196195
elif ptype == "depth":
197-
cbar.ax.set_title(units, fontsize=10)
198-
cbar.set_label("Precipitation depth")
196+
cbar.set_label(f"Precipitation depth [{units}]")
199197
else:
200-
cbar.set_label("P(R > %.1f %s)" % (probthr, units))
198+
cbar.set_label(f"P(R > {probthr:.1f} {units})")
201199

202200
if geodata is None or axis == "off":
203201
ax.xaxis.set_ticks([])

0 commit comments

Comments
 (0)