From: <ra...@gm...> - 2005-04-26 21:04:09
|
Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3 machine. I am (and= =20 have been) using ipython 0.6.13 as my shell. After the upgrade, plots from= =20 scripts are no longer interactive - I need an explicit call to pylab.show()= =20 to show the plots.=20 Do I need to update some settings? I am using the GTKAgg backend with all=20 default parameters (no user-specific .matplotlibrc) and I compiled matplotl= ib=20 from sources. Here is a simple script that no longer updates 100 times but= =20 just shows once: import scipy import matplotlib from matplotlib import pylab #matplotlib.interactive(True) for x in scipy.arange(100): pylab.plot(scipy.randn(1000)+x) =46rom the ipython prompt, I issued the command run scriptAbove.py where ipython was invoked as follows: ipython -pylab -p scipy Is this an ipython issue or a matplotlib issue? Any help greatly appreciate= d. Regards, Ravi |
From: John H. <jdh...@ac...> - 2005-04-26 21:27:14
|
>>>>> "ravi" == ravi <ra...@gm...> writes: ravi> Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3 ravi> machine. I am (and have been) using ipython 0.6.13 as my ravi> shell. After the upgrade, plots from scripts are no longer ravi> interactive - I need an explicit call to pylab.show() to ravi> show the plots. ravi> Do I need to update some settings? I am using the GTKAgg ravi> backend with all default parameters (no user-specific ravi> .matplotlibrc) and I compiled matplotlib from sources. Here ravi> is a simple script that no longer updates 100 times but just ravi> shows once: Fernando and I made a conscious choice to turn off interactive mode when running scripts from ipython, since this is usually what people want and has better performance. To override this, to need to explicitly turn on/and off interactive mode where desired, and possibly explicitly call draw in the animation loop where you want the figure to be refreshed. import scipy import matplotlib from matplotlib import pylab pylab.ion() # turn on interactive mode for x in scipy.arange(100): pylab.plot(scipy.randn(1000)+x) pylab.show() You can turn interactive mode on and off where desired with pylab.ion and pylab.ioff (to suppress draws for a sequence of figure updates) and explicitly draw where desired with pylab.draw. Details at http://matplotlib.sf.net/interactive.html. JDH |
From: <ra...@gm...> - 2005-04-27 15:07:16
|
On Tuesday 26 April 2005 05:26 pm, John Hunter wrote: > Fernando and I made a conscious choice to turn off interactive mode Fair enough, but the change needs to be documented as such either in the ipython manual or in the matplotlib changelog. > You can turn interactive mode on and off where desired with pylab.ion > and pylab.ioff (to suppress draws for a sequence of figure updates) > and explicitly draw where desired with pylab.draw. Now that explicit control is necessary with draw(), could we go one step further and ask for just one figure/subplot to be updated with the pythonic API? Perhaps something along the lines of the following: myFigure = pylab.figure() myPlot1 = myfigure.add_subplot(2,1,1) myPlot2 = myfigure.add_subplot(2,1,2) doSetup() for x in arange(y): z = doSomething() myPlot1.plot(...) myPlot1.drawNow() # New API if hokeyRareCondition: myPlot2.plot(...) myPlot2.drawNow() # New API I see that there is a function in the figure API for drawing to a renderer but I do not know how to use it to get the drawNow() effect. Regards, Ravi |
From: Tim L. <ti...@cs...> - 2005-04-27 15:18:07
|
On Wed, 27 Apr 2005, ra...@gm... <ra...@gm...> wrote... > > You can turn interactive mode on and off where desired with pylab.ion > > and pylab.ioff (to suppress draws for a sequence of figure updates) > > and explicitly draw where desired with pylab.draw. > > Now that explicit control is necessary with draw(), could we go one step > further and ask for just one figure/subplot to be updated with the pythonic > API? Perhaps something along the lines of the following: > > myFigure = pylab.figure() > myPlot1 = myfigure.add_subplot(2,1,1) > myPlot2 = myfigure.add_subplot(2,1,2) > doSetup() > for x in arange(y): > z = doSomething() > myPlot1.plot(...) > myPlot1.drawNow() # New API > if hokeyRareCondition: > myPlot2.plot(...) > myPlot2.drawNow() # New API > > I see that there is a function in the figure API for drawing to a renderer but > I do not know how to use it to get the drawNow() effect. Could I +1 this as a request. I had a look into trying to do this myself but got down to the level of renderers and decided to leave it alone, since it's not really critical to me, just a nice feature if it existed. Cheers, Tim > > Regards, > Ravi > > > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > `- |
From: <Fer...@co...> - 2005-04-27 23:32:49
|
Quoting John Hunter <jdh...@ni...>: > >>>>> "ravi" == ravi <ra...@gm...> writes: > > ravi> Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3 > ravi> machine. I am (and have been) using ipython 0.6.13 as my > ravi> shell. After the upgrade, plots from scripts are no longer > ravi> interactive - I need an explicit call to pylab.show() to > ravi> show the plots. > > ravi> Do I need to update some settings? I am using the GTKAgg > ravi> backend with all default parameters (no user-specific > ravi> .matplotlibrc) and I compiled matplotlib from sources. Here > ravi> is a simple script that no longer updates 100 times but just > ravi> shows once: > > Fernando and I made a conscious choice to turn off interactive mode > when running scripts from ipython, since this is usually what people > want and has better performance. To override this, to need to > explicitly turn on/and off interactive mode where desired, and > possibly explicitly call draw in the animation loop where you want the > figure to be refreshed. > > import scipy > import matplotlib > from matplotlib import pylab > > pylab.ion() # turn on interactive mode > for x in scipy.arange(100): > pylab.plot(scipy.randn(1000)+x) > > pylab.show() A small note to clarify why we did this: we wanted to make sure that a script which works correctly under ipython's %run will work equally well outside of ipython. That's why I removed the automagic calling of show() by ipython, to force users to write valid matplotlib scripts regardless of where they want to run them. You only need to use ion/ioff if you want to have fine control over how matplotlib updates its plots. I personally never use those, and I simply make sure that all my mpl scripts have a show() call on their last line. Regards, f |