Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Close
From: Matthias Michler <MatthiasM<ichler@gm...>  20070213 12:21:58

Hello everbody, sometimes I need an autoscaling when my new data points in a figure have small values compared to some deleted ones. So I thought ax.autoscale_view() would be the solution, but it seems to remember deleted data and so doesn't scale limits like I want. A little program showing my problem can be seen below. Could anyone help me or give me a little hint? Thanks in advance, Matthias > import pylab as P P.ion() P.figure() ax = P.subplot(111) P.plot(P.array([0,1]), P.array([0,2])) P.plot(P.array([1.1,2]), P.array([2.2,4])) P.draw() raw_input(" delete one graph by pressing <return>") ax.lines.pop(1) P.draw() P.draw() raw_input(" manually setting new limits by pressing <return>") ax.set_autoscale_on = False ax.axis([0.1, 1.1, 0.1, 2.1]) ax.set_autoscale_on = True P.draw() P.draw() raw_input(" do 'ax.autoscale_view()' by pressing <return> ") ax.autoscale_view() P.draw() P.draw() # autoscale_view() rescales to old limits with all of the data raw_input(" end programm by pressing <return>") P.ioff() > 
From: Matthias Michler <MatthiasM<ichler@gm...>  20070423 16:34:03

Hi everybody, some time ago I send the first mail concerning "pylab.autoscale_view()". Unfortunately nobody reponsed  so I ask you again for any suggestions. If I should set up another example or explain it, please let me know. best regards and thanks in advance for any hint, Matthias On Tuesday 13 February 2007 13:21, Matthias Michler wrote: > Hello everbody, > > sometimes I need an autoscaling when my new data points in a figure have > small values compared to some deleted ones. So I thought > ax.autoscale_view() would be the solution, but it seems to remember deleted > data and so doesn't scale limits like I want. A little program showing my > problem can be seen below. > > Could anyone help me or give me a little hint? > > Thanks in advance, > > Matthias > > > > > > > import pylab as P > > P.ion() > P.figure() > ax = P.subplot(111) > P.plot(P.array([0,1]), P.array([0,2])) > P.plot(P.array([1.1,2]), P.array([2.2,4])) > P.draw() > > raw_input(" delete one graph by pressing <return>") > ax.lines.pop(1) > P.draw() > P.draw() > > raw_input(" manually setting new limits by pressing <return>") > ax.set_autoscale_on = False > ax.axis([0.1, 1.1, 0.1, 2.1]) > ax.set_autoscale_on = True > P.draw() > P.draw() > > raw_input(" do 'ax.autoscale_view()' by pressing <return> ") > ax.autoscale_view() > P.draw() > P.draw() > # autoscale_view() rescales to old limits with all of the data > raw_input(" end programm by pressing <return>") > P.ioff() > > > 
From: Eric Firing <efiring@ha...>  20070423 18:37:36

Matthias Michler wrote: > Hi everybody, > > some time ago I send the first mail concerning "pylab.autoscale_view()". > Unfortunately nobody reponsed  so I ask you again for any suggestions. > If I should set up another example or explain it, please let me know. > > best regards and thanks in advance for any hint, > Matthias > > On Tuesday 13 February 2007 13:21, Matthias Michler wrote: >> Hello everbody, >> >> sometimes I need an autoscaling when my new data points in a figure have >> small values compared to some deleted ones. So I thought >> ax.autoscale_view() would be the solution, but it seems to remember deleted >> data and so doesn't scale limits like I want. A little program showing my >> problem can be seen below. >> >> Could anyone help me or give me a little hint? The autoscaling mechanism does not keep track of plot elements, so it has no way of knowing what to change when you delete a line. You will have to keep track of the x and y extents of each element yourself, and manually reset the xlim and ylim when you want to rescale after deleting a line. This can be done with the Axes set_xlim and set_ylim methods. Eric >> >> Thanks in advance, >> >> Matthias >> >>>  >>>  >> import pylab as P >> >> P.ion() >> P.figure() >> ax = P.subplot(111) >> P.plot(P.array([0,1]), P.array([0,2])) >> P.plot(P.array([1.1,2]), P.array([2.2,4])) >> P.draw() >> >> raw_input(" delete one graph by pressing <return>") >> ax.lines.pop(1) >> P.draw() >> P.draw() >> >> raw_input(" manually setting new limits by pressing <return>") >> ax.set_autoscale_on = False >> ax.axis([0.1, 1.1, 0.1, 2.1]) >> ax.set_autoscale_on = True >> P.draw() >> P.draw() >> >> raw_input(" do 'ax.autoscale_view()' by pressing <return> ") >> ax.autoscale_view() >> P.draw() >> P.draw() >> # autoscale_view() rescales to old limits with all of the data >> raw_input(" end programm by pressing <return>") >> P.ioff() >> >>>  > >  > This SF.net email is sponsored by DB2 Express > Download DB2 Express C  the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: John Hunter <jdh2358@gm...>  20070425 13:23:33

On 4/23/07, Eric Firing <efiring@...> wrote: > The autoscaling mechanism does not keep track of plot elements, so it > has no way of knowing what to change when you delete a line. You will > have to keep track of the x and y extents of each element yourself, and > manually reset the xlim and ylim when you want to rescale after deleting > a line. This can be done with the Axes set_xlim and set_ylim methods. I recently added a helper function "relim" in svn in the Axes class to automatically recomupte the data limits. After removing various lines, simply do ax.relim() ax.autoscale_view() but you will need svn... 