How to give Matplolib imshow plot colorbars a label

12k Views Asked by At

We can give x and y axes labels for the main axes. Is there any way to similarly give a color bar a label? Alternately, is there any way to append a unit to one or more colorbar ticks?

2

There are 2 best solutions below

0
On

You use annotate to place text just about anywhere and add an arrow to what it refers to see some examples here.

2
On

Like many axis objects, colorbar() has a set_label() method:

cbar = fig.colorbar(heatmap) 
cbar.set_label('Label name',size=18)