How to set the number of digits of the ticks?

Hello all

I am tryint to plot the ticks in scientific notation, and I would like to
set the tick size to 2 digits (i.e. 0.5 x e-7). Instead, I am either loosing
the scientific notation or getting the scientific notation with a number of
too many decimal positions.

The problem is that my numbers are of e-7 order and if I just try to round
the number of decimal positions, I get a value of 0.0...

Here's my script

majorLocator = MultipleLocator(PSD_2z.max()/3.0)
majorformatter = FormatStrFormatter('%1.1e') # or (%0.1f)
ax1 = fig.add_subplot(511)
ax1.ticklabel_format(style='sci',scilimits=(0,0), axis='y')

Thanks for your help!


View this message in context:
Sent from the matplotlib - users mailing list archive at