autoscale problem?

Hello,

When I run:

from pylab import *
data = [1.6e-012, 3.0e-012]
plot(data)

the y axis autoscales to 1.8e-12 - 3.2e-12. I get the same behavior when I run in interactive mode or save the figure to png.

Does anyone know if this is a bug or if there's something I can do to make the autoscaling work out?

Thanks,
John

P.S. Here's the output from the --verbose-helpful flag:

matplotlib data path c:\pyle\python23\share\matplotlib
loaded rc file c:\pyle\python23\share\matplotlib\.matplotlibrc
matplotlib version 0.72.1
verbose.level helpful
interactive is False
platform is win32
numerix numarray 1.2.2
font search path ['c:\\pyle\\python23\\share\\matplotlib']
loaded ttfcache file C:/msys/1.0/home/artsys\.ttffont.cache
backend Agg version v2.2

Hi John,

It is a bug. I suggest making the following change to ticker.py, starting at
line 501 in version 0.72.1:

    def le(self, x):
        'return the largest multiple of base <= x'
        d,m = divmod(x, self._base)
        if closeto(m/self._base,1): # was closeto(m, self._base)
            #looks like floating point error
            return (d+1)*self._base
        else:
            return d*self._base

Darren

···

On Wednesday 16 March 2005 06:26 pm, John Pyle wrote:

Hello,

When I run:

from pylab import *
data = [1.6e-012, 3.0e-012]
plot(data)

the y axis autoscales to 1.8e-12 - 3.2e-12. I get the same behavior when
I run in interactive mode or save the figure to png.

Does anyone know if this is a bug or if there's something I can do to
make the autoscaling work out?

Thanks,
John

P.S. Here's the output from the --verbose-helpful flag:

matplotlib data path c:\pyle\python23\share\matplotlib
loaded rc file c:\pyle\python23\share\matplotlib\.matplotlibrc
matplotlib version 0.72.1
verbose.level helpful
interactive is False
platform is win32
numerix numarray 1.2.2
font search path ['c:\\pyle\\python23\\share\\matplotlib']
loaded ttfcache file C:/msys/1.0/home/artsys\.ttffont.cache
backend Agg version v2.2

-------------------------------------------------------
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.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--

Darren

I was testing this bugfix with plot([1.4e-12,3.0e-12]), and noticed that the
1.4e-12 ticklabel was being dropped.

In ticker.py, I suggest replacing Base.ge with:

    def ge(self, x):
        'return the largest multiple of base >= x'
        d,m = divmod(x, self._base)
        if closeto(m,0) and not closeto(m/self._base,1): return x
        return (d+1)*self._base

The fourth line used to be if m==0: return x, which fails sometimes due to
floating point inaccuracy. John, remember I was complaining about how certain
ticklabels wouldnt get rendered in the new scalarformatter I posted a couple
weeks ago? This was the problem.

Darren

···

On Wednesday 16 March 2005 07:59 pm, Darren Dale wrote:

I suggest making the following change to ticker.py, starting
at line 501 in version 0.72.1:

    def le(self, x):
        'return the largest multiple of base <= x'
        d,m = divmod(x, self._base)
        if closeto(m/self._base,1): # was closeto(m, self._base)
            #looks like floating point error
            return (d+1)*self._base
        else:
            return d*self._base

Darren,

This works great for me - thanks!

I should have said this earlier, but matplotlib is excellent! Thank you to everyone who works on it.

John

Darren Dale wrote:

···

On Wednesday 16 March 2005 07:59 pm, Darren Dale wrote:

I suggest making the following change to ticker.py, starting
at line 501 in version 0.72.1:

   def le(self, x):
       'return the largest multiple of base <= x'
       d,m = divmod(x, self._base)
       if closeto(m/self._base,1): # was closeto(m, self._base)
           #looks like floating point error
           return (d+1)*self._base
       else:
           return d*self._base

I was testing this bugfix with plot([1.4e-12,3.0e-12]), and noticed that the 1.4e-12 ticklabel was being dropped.

In ticker.py, I suggest replacing Base.ge with:

   def ge(self, x):
       'return the largest multiple of base >= x'
       d,m = divmod(x, self._base)
       if closeto(m,0) and not closeto(m/self._base,1): return x
       return (d+1)*self._base

The fourth line used to be if m==0: return x, which fails sometimes due to floating point inaccuracy. John, remember I was complaining about how certain ticklabels wouldnt get rendered in the new scalarformatter I posted a couple weeks ago? This was the problem.

Darren