[Matplotlib-users] removing leading zeros in ticklabels

2009-02-28 Thread per freem
hi all, when i make any numeric scatter plot containing floats, the formatted tick labels always have leading zeros, e.g 0.5 as opposed to .5 in the labels. for example: x = rand(10) scatter(x,x) is there any way to change this to remove the leading zeros? i have tried: s = subplot(111)

Re: [Matplotlib-users] removing leading zeros in ticklabels

2009-02-28 Thread Jae-Joon Lee
FormatStrFormatter (and other formatters) rely on Python's string interpolation, and It does not seem to be possible to get rid of the leading zero (http://docs.python.org/library/stdtypes.html). I think what you can do is to replace 0. with . after the interpolation. Something like below works