 # 'bug' in labelling axes for data with small variation?

Dear Matplotlib developers,

running the following program

import pylab

x=pylab.arange(0,1e-8,1e-9)+1.0
pylab.plot(x)
pylab.show()

with matplotlib 0.70.1 results in a graph that shows:

(i) correctly the linear increase of x
(ii) but the labels on the y-axis of the plot all show "1e", apart from the lowest one, which shows (correctly) just "1".

All works fine when I subtract the mean of x but there seems to be a problem with labelling axes for plotted data which is not close to zero but shows only small variations.

By the way: thank you for providing matplotlib.

Cheers,

Hans

Hi Hans,

Let me ask, what do you think would be the correct labels? As I remember,
Matlab will go out to 4 decimal points, so your ticks would be labeled
1,1.0000,1.0000.

I have been meaning to do some work with the tick formatters. It has been
suggested here that all significant digits are preserved, so for example,
your ticks would be 1,1,1 (If you want to go out to 9 sig digits, I think you
would have to write your own custom formatter, which is discussed on this
list and in the user's guide). If you ticks are 1,1.01,1.02, the labels would
be 1.00,1.01,1.02. I think this results in the best looking result, but I'd
like to know others opinions before I start. Also, for ticks like
1e5,2e5,3e5, I am intending to make the ticks 1,2,3, and have a x10^5 just
outside the axis or in the last label. Comments, suggestions?

Darren

···

On Thursday 24 February 2005 05:53 am, Hans Fangohr wrote:

Dear Matplotlib developers,

running the following program

import pylab

x=pylab.arange(0,1e-8,1e-9)+1.0
pylab.plot(x)
pylab.show()

with matplotlib 0.70.1 results in a graph that shows:

(i) correctly the linear increase of x
(ii) but the labels on the y-axis of the plot all show "1e", apart from
the lowest one, which shows (correctly) just "1".

All works fine when I subtract the mean of x but there seems to be a
problem with labelling axes for plotted data which is not close to zero
but shows only small variations.

By the way: thank you for providing matplotlib.

Cheers,

Hans

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.