I am trying to put a colorbar to my image using matplotlib. The issue comes when I try to force the ticklabels to be written in scientific notation. How can I force the scie
There is a more straightforward (but less customizable) way to get scientific notation in a ColorBar
without the %.0e
formatting.
Create your ColorBar
:
cbar = plt.colorbar()
And call the formatter:
cbar.formatter.set_powerlimits((0, 0))
This will make the ColorBar
use scientific notation. See the example figure below to see how the ColorBar
will look.