Eric -

I just installed version 0.90 on my windows machine and it seems that
axis('scaled') doesn't work properly yet.
I thought axis('scaled') will change the axes such that the aspect ratio is
equal WITHOUT changing the limits on the axes.
A simple example shows that this goes wrong (I thought this used to work):

from pylab import *
plot([1,2,3],[1,2,1])
axis([1,2,1,2])  # define new axis limits
axis('scaled')

And now Python comes back with (1.0, 3.0, 0.80000000000000004, 2.0), which
are the limits of the original plot command obtained using autoscale_view.
I think this is an easy fix in the axis function of axes.py.
Here you do an autoscale_view, which shouldn't be done in the 'scaled'
option.
I think you only need to change the indicated line below.

Thanks,

Mark

   def axis(self, *v, **kwargs):
       '''
       Convenience method for manipulating the x and y view limits
       and the aspect ratio of the plot.

       kwargs are passed on to set_xlim and set_ylim -- see their
docstrings for details
       '''
       if len(v)==1 and is_string_like(v[0]):
           s = v[0].lower()
           if s=='on': self.set_axis_on()
           elif s=='off': self.set_axis_off()
           elif s in ('equal', 'tight', 'scaled', 'normal', 'auto',
'image'):
               self.set_autoscale_on(True)
               self.set_aspect('auto')
               if s!= 'scaled': self.autoscale_view()  # THIS LINE WAS
CHANGED BY ADDING THE IF STATEMENT
               self.apply_aspect()
               if s=='equal':
                   self.set_aspect('equal', adjustable='datalim')
               elif s == 'scaled':
                   self.set_aspect('equal', adjustable='box', anchor='C')
                   self.set_autoscale_on(False) # Req. by Mark Bakker
               elif s=='tight':
                   self.autoscale_view(tight=True)
                   self.set_autoscale_on(False)
               elif s == 'image':
                   self.autoscale_view(tight=True)
                   self.set_autoscale_on(False)
                   self.set_aspect('equal', adjustable='box', anchor='C')
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to