Autoscale in pylab-interface

Nikolai -
The axis('equal') does not fix the scales, and place the plot in the
center (as far as I know this mimics matlab behavior). The
axis('scaled') is a variation on this theme that does fix the scale
and puts the plot in the lower left hand corner. Obviously, many more
permutations are possible. If many people think another pylab option
would be crucial we can always add one more.
Mark

--- From: Nikolai Hlubek <nikolai.hlubek@...573...>

Hi everyone

When looking at the little code example below
it can be seen see that you have to mix programming
paradigms to disable autoscaling:

   figure(1)
   ax = subplot(111)
   axis((-0.25,2.0,0.0,1.3))
   axis('scaled')
   ax.set_autoscale_on(False)

Wouldn't another 'axis' option make the
whole thing more consistent?

   figure(1)
   axis((-0.25,2.0,0.0,1.3))
   axis('scaled')
   axis(autoscale=False)

Best regards,
Nikolai

Hi,
I miss the equivalent to "axis image" in matlab, axis('scaled') is
very close to beeing
the same except it does not preserve figure axis ranges and ratio when
I resize my window.

what methods are called after a window resize event in gtkagg anyway?

Helge

···

On 3/7/06, Mark Bakker <markbak@...287...> wrote:

Nikolai -
The axis('equal') does not fix the scales, and place the plot in the
center (as far as I know this mimics matlab behavior). The
axis('scaled') is a variation on this theme that does fix the scale
and puts the plot in the lower left hand corner. Obviously, many more
permutations are possible. If many people think another pylab option
would be crucial we can always add one more.

Hi Mark, hi everyone

The code I posted was taken from one of my programs
and for the sake of simplicity I left a few parts out.
That may have made my intention a bit unclear.
I'm sorry for that.

Here are all the relevant parts:

def main():

    if cts['show_qm']: qmx, qmy = read_qm()
    if cts['show_cm']: cmx, cmy = read_cm()

    figure(1)
    ax = subplot(111)
    axis((-0.25,2.0,0.0,1.3))
    axis('scaled')
    ax.set_autoscale_on(False)

    for i in range(100):
        if cts['show_qm']: plot((qmx[i],qmx[i]),(qmy[i],qmy[i]),'bo')
        if cts['show_cm']: plot((cmx[i],cmx[i]),(cmy[i],cmy[i]),'go')
        raw_input('Press <enter> to continue')

if __name__ == "__main__":
    ion()
    main()
    show()

The program reads two lists of points and plots them one
by one so I can compare them, which is why I need axis('scaled'). The
autoscale property on the other hand is used that the plot commands in
the for loop don't thouch the axis. The program does exactly what I want
it to do and is fast enough despite my inefficient code since it only
has to plot 100 points.

But since there is only one axis in the figure I thought it would be a
good idea if I could disable autoscaling in the way the limits and the
'scaled' property were set.
The other point I wrote this was because I couldn't find any
documentation on the autoscale behaviour except for an old thread on
this list. If autoscale would be an option of the axis command it could
be found on:
http://matplotlib.sourceforge.net/pylab_commands.html

Best regards,
Nikolai

···

--
"1984" is not a howto!