Eric -

Thanks for your reply.
Let me give you my idea about axis('scaled') and why I am asking for a
change (a new option would be fine as well).

What people I talked to do is, they plot some background (say roads) for a
large area; in interactive mode. Then they contour a small portion of that
area, for which they made a model, and zoom in. Then they realize: oh, I
haven't set the aspect ratio, so they do axis('scaled') and boom, they are
zoomed out again to the full extend of all the roads they have as a
background. This is a surprisingly common, and I see it a lot, also with
people using Matlab. It drives you bonkers. If you use axis('equal'), also
in Matlab, every time you add something to the plot, it zooms out to the
full extend again. And drives you up the wall. That's is why I made
axis('scaled'). I want to use the axis limits the user has specified and not
monckey with it. That works fine now (thanks!), except for the very first
time you do axis('scaled'), then it zooms out to the full extend. It doesn't
make much sense to me to do it the first time, but not any of the other
times.

I hope this makes some sense. So what to do next. My preference is to make
the change I suggested. My second choice is to define a new option that does
what I request, as I think this will get a lot of use. Then we would have to
come up with a new option name.

Let me know what you think,

Mark

On 2/14/07, Eric Firing <[EMAIL PROTECTED]> wrote:

Mark,

It sounds like what you want axis('scaled') to do is nothing other than

gca().set_aspect(1, adjustable='box')
draw_if_interactive()

I think this is a bit out of character with things like axis('equal').
Part of this character is that automatic things are turned on, so that
going back and forth between axis('equal') and axis('scaled') switches
back and forth between the same two plots; the result is not
history-dependent.

At your request (between the 0.87.7 and 0.90 releases), I put in a
little bit of history-dependence by making axis('scaled') call to
                     self.set_autoscale_on(False) # Req. by Mark Bakker
after the set_aspect() call.  This means that you can get the behavior
you want simply by changing your example to

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

Is this good enough?  Do you really need to be able to set the axis
limits *before* the call to axis('scaled')?  If so, then I am inclined
to make this a separate option for the axis command, because I think the
present behavior of axis('scaled') is sensible in the context of the
other existing options.

Eric


Mark Bakker wrote:
> 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


-------------------------------------------------------------------------
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