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')
ax1.yaxis.set_major_locator(MultipleLocator(ax1.get_ylim()[1]/3.0))
ax1.yaxis.set_major_formatter(majorformatter)

Thanks for your help!

···


View this message in context: http://old.nabble.com/How-to-set-the-number-of-digits-of-the-ticks--tp31250240p31250240.html
Sent from the matplotlib - users mailing list archive at Nabble.com.