|
From: tva <tv...@br...> - 2009-09-06 19:06:20
|
Hi all with matplotlib 0.98.5.3 this script will draw new lines as the scrips is running: from pylab import * x = arange(0,2*pi,0.01) for i in arange(1,20): y=sin(x+i) plot(x,y) # update the data show() with matplotlib 0.99, the exact same script runs to the end without plotting and then plots all the lines. This is just a trivial example but for some applications it is useful to monitor the evolution of curves as the script is running - allows me to update parameters if something diverges. Any idea why there is such a difference between 0.98.5.3 and 0.99 ?? -- View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jae-Joon L. <lee...@gm...> - 2009-09-07 01:29:55
|
I presume you're running that script in interactive shell? Try draw() instead of show(). Regards, -JJ On Sun, Sep 6, 2009 at 3:06 PM, tva<tv...@br...> wrote: > > Hi all > > with matplotlib 0.98.5.3 this script will draw new lines as the scrips is > running: > > from pylab import * > x = arange(0,2*pi,0.01) > for i in arange(1,20): > > y=sin(x+i) > plot(x,y) # update the data > show() > > > with matplotlib 0.99, the exact same script runs to the end without plotting > and then plots all the lines. This is just a trivial example but for some > applications it is useful to monitor the evolution of curves as the script > is running - allows me to update parameters if something diverges. > Any idea why there is such a difference between 0.98.5.3 and 0.99 ?? > -- > View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: tva <tv...@br...> - 2009-09-07 07:18:09
|
Thanks JJ, but unfortunately this is not the solution. draw() gives the same result. - and I am running this as a script (running it from ipython shell). Any clue? Jae-Joon Lee wrote: > > I presume you're running that script in interactive shell? > Try draw() instead of show(). > > Regards, > > -JJ > > > On Sun, Sep 6, 2009 at 3:06 PM, tva<tv...@br...> wrote: >> >> Hi all >> >> with matplotlib 0.98.5.3 this script will draw new lines as the scrips is >> running: >> >> from pylab import * >> x = arange(0,2*pi,0.01) >> for i in arange(1,20): >> >> y=sin(x+i) >> plot(x,y) # update the data >> show() >> >> >> with matplotlib 0.99, the exact same script runs to the end without >> plotting >> and then plots all the lines. This is just a trivial example but for some >> applications it is useful to monitor the evolution of curves as the >> script >> is running - allows me to update parameters if something diverges. >> Any idea why there is such a difference between 0.98.5.3 and 0.99 ?? >> -- >> View this message in context: >> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - and >> focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25326025.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Michiel de H. <mjl...@ya...> - 2009-09-07 09:24:25
|
> Any idea why there is such a difference between > 0.98.5.3 and 0.99 ?? Drawing the whole figure once, when no further Python input is available, is much more efficient than drawing after each plot() command. For some figures, matplotlib 0.98.5.3 becomes extremely slow. > Thanks JJ, but unfortunately this is not the solution. > draw() gives the same result. - and I am running this > as a script (running it from ipython shell). The problem in your script is that the event loop never kicks in. Unfortunately, Python has no support for event loops in general, which makes this hard to solve. One option is to use raw_input() between calls to plot(), but then each time you have to hit <enter> to get the script to proceed. --Michiel. --- On Mon, 9/7/09, tva <tv...@br...> wrote: > From: tva <tv...@br...> > Subject: Re: [Matplotlib-users] cannot plot in loops with matplotlib 0.99. 0.98 works fine > To: mat...@li... > Date: Monday, September 7, 2009, 3:17 AM > > Thanks JJ, but unfortunately this is not the solution. > draw() gives the same > result. - and I am running this as a script (running it > from ipython shell). > > Any clue? > > > > > > Jae-Joon Lee wrote: > > > > I presume you're running that script in interactive > shell? > > Try draw() instead of show(). > > > > Regards, > > > > -JJ > > > > > > On Sun, Sep 6, 2009 at 3:06 PM, tva<tv...@br...> > wrote: > >> > >> Hi all > >> > >> with matplotlib 0.98.5.3 this script will draw new > lines as the scrips is > >> running: > >> > >> from pylab import * > >> x = arange(0,2*pi,0.01) > >> for i in arange(1,20): > >> > >> y=sin(x+i) > >> plot(x,y) # update the data > >> show() > >> > >> > >> with matplotlib 0.99, the exact same script runs > to the end without > >> plotting > >> and then plots all the lines. This is just a > trivial example but for some > >> applications it is useful to monitor the evolution > of curves as the > >> script > >> is running - allows me to update parameters if > something diverges. > >> Any idea why there is such a difference between > 0.98.5.3 and 0.99 ?? > >> -- > >> View this message in context: > >> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html > >> Sent from the matplotlib - users mailing list > archive at Nabble.com. > >> > >> > >> > ------------------------------------------------------------------------------ > >> Let Crystal Reports handle the reporting - Free > Crystal Reports 2008 > >> 30-Day > >> trial. Simplify your report design, integration > and deployment - and > >> focus on > >> what you do best, core application coding. > Discover what's new with > >> Crystal Reports now. http://p.sf.net/sfu/bobj-july > >> _______________________________________________ > >> Matplotlib-users mailing list > >> Mat...@li... > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >> > > > > > ------------------------------------------------------------------------------ > > Let Crystal Reports handle the reporting - Free > Crystal Reports 2008 > > 30-Day > > trial. Simplify your report design, integration and > deployment - and focus > > on > > what you do best, core application coding. Discover > what's new with > > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > -- > View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25326025.html > Sent from the matplotlib - users mailing list archive at > Nabble.com. > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal > Reports 2008 30-Day > trial. Simplify your report design, integration and > deployment - and focus on > what you do best, core application coding. Discover what's > new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: tva <tv...@br...> - 2009-09-07 09:49:27
|
Hi Michiel thanks, but does that explain why the script works smoothly in 0.98.6 and earlier versions? Plotting all the curves at the end of the script is certainly possible, but it is a severe reduction of the functionallity. given the fact that it works so well in earlier versions of matplotlib, it seems like a bug in matplotlib...? Michiel de Hoon wrote: > >> Any idea why there is such a difference between >> 0.98.5.3 and 0.99 ?? > > Drawing the whole figure once, when no further Python input is available, > is much more efficient than drawing after each plot() command. For some > figures, matplotlib 0.98.5.3 becomes extremely slow. > >> Thanks JJ, but unfortunately this is not the solution. >> draw() gives the same result. - and I am running this >> as a script (running it from ipython shell). > > The problem in your script is that the event loop never kicks in. > Unfortunately, Python has no support for event loops in general, which > makes this hard to solve. One option is to use raw_input() between calls > to plot(), but then each time you have to hit <enter> to get the script to > proceed. > > --Michiel. > > > --- On Mon, 9/7/09, tva <tv...@br...> wrote: > >> From: tva <tv...@br...> >> Subject: Re: [Matplotlib-users] cannot plot in loops with matplotlib >> 0.99. 0.98 works fine >> To: mat...@li... >> Date: Monday, September 7, 2009, 3:17 AM >> >> Thanks JJ, but unfortunately this is not the solution. >> draw() gives the same >> result. - and I am running this as a script (running it >> from ipython shell). >> >> Any clue? >> >> >> >> >> >> Jae-Joon Lee wrote: >> > >> > I presume you're running that script in interactive >> shell? >> > Try draw() instead of show(). >> > >> > Regards, >> > >> > -JJ >> > >> > >> > On Sun, Sep 6, 2009 at 3:06 PM, tva<tv...@br...> >> wrote: >> >> >> >> Hi all >> >> >> >> with matplotlib 0.98.5.3 this script will draw new >> lines as the scrips is >> >> running: >> >> >> >> from pylab import * >> >> x = arange(0,2*pi,0.01) >> >> for i in arange(1,20): >> >> >> >> y=sin(x+i) >> >> plot(x,y) # update the data >> >> show() >> >> >> >> >> >> with matplotlib 0.99, the exact same script runs >> to the end without >> >> plotting >> >> and then plots all the lines. This is just a >> trivial example but for some >> >> applications it is useful to monitor the evolution >> of curves as the >> >> script >> >> is running - allows me to update parameters if >> something diverges. >> >> Any idea why there is such a difference between >> 0.98.5.3 and 0.99 ?? >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html >> >> Sent from the matplotlib - users mailing list >> archive at Nabble.com. >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Let Crystal Reports handle the reporting - Free >> Crystal Reports 2008 >> >> 30-Day >> >> trial. Simplify your report design, integration >> and deployment - and >> >> focus on >> >> what you do best, core application coding. >> Discover what's new with >> >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> >> _______________________________________________ >> >> Matplotlib-users mailing list >> >> Mat...@li... >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > >> > >> ------------------------------------------------------------------------------ >> > Let Crystal Reports handle the reporting - Free >> Crystal Reports 2008 >> > 30-Day >> > trial. Simplify your report design, integration and >> deployment - and focus >> > on >> > what you do best, core application coding. Discover >> what's new with >> > Crystal Reports now. http://p.sf.net/sfu/bobj-july >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25326025.html >> Sent from the matplotlib - users mailing list archive at >> Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal >> Reports 2008 30-Day >> trial. Simplify your report design, integration and >> deployment - and focus on >> what you do best, core application coding. Discover what's >> new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25327845.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: tva <tv...@br...> - 2009-09-07 17:02:47
|
Problem solved. The backend was set to Qt4Agg. Once set to TkAgg everything works. I don't get it but it works.......... tva wrote: > > Hi Michiel > > thanks, but does that explain why the script works smoothly in 0.98.6 and > earlier versions? > Plotting all the curves at the end of the script is certainly possible, > but it is a severe reduction of the functionallity. given the fact that it > works so well in earlier versions of matplotlib, it seems like a bug in > matplotlib...? > > > > > Michiel de Hoon wrote: >> >>> Any idea why there is such a difference between >>> 0.98.5.3 and 0.99 ?? >> >> Drawing the whole figure once, when no further Python input is available, >> is much more efficient than drawing after each plot() command. For some >> figures, matplotlib 0.98.5.3 becomes extremely slow. >> >>> Thanks JJ, but unfortunately this is not the solution. >>> draw() gives the same result. - and I am running this >>> as a script (running it from ipython shell). >> >> The problem in your script is that the event loop never kicks in. >> Unfortunately, Python has no support for event loops in general, which >> makes this hard to solve. One option is to use raw_input() between calls >> to plot(), but then each time you have to hit <enter> to get the script >> to proceed. >> >> --Michiel. >> >> >> --- On Mon, 9/7/09, tva <tv...@br...> wrote: >> >>> From: tva <tv...@br...> >>> Subject: Re: [Matplotlib-users] cannot plot in loops with matplotlib >>> 0.99. 0.98 works fine >>> To: mat...@li... >>> Date: Monday, September 7, 2009, 3:17 AM >>> >>> Thanks JJ, but unfortunately this is not the solution. >>> draw() gives the same >>> result. - and I am running this as a script (running it >>> from ipython shell). >>> >>> Any clue? >>> >>> >>> >>> >>> >>> Jae-Joon Lee wrote: >>> > >>> > I presume you're running that script in interactive >>> shell? >>> > Try draw() instead of show(). >>> > >>> > Regards, >>> > >>> > -JJ >>> > >>> > >>> > On Sun, Sep 6, 2009 at 3:06 PM, tva<tv...@br...> >>> wrote: >>> >> >>> >> Hi all >>> >> >>> >> with matplotlib 0.98.5.3 this script will draw new >>> lines as the scrips is >>> >> running: >>> >> >>> >> from pylab import * >>> >> x = arange(0,2*pi,0.01) >>> >> for i in arange(1,20): >>> >> >>> >> y=sin(x+i) >>> >> plot(x,y) # update the data >>> >> show() >>> >> >>> >> >>> >> with matplotlib 0.99, the exact same script runs >>> to the end without >>> >> plotting >>> >> and then plots all the lines. This is just a >>> trivial example but for some >>> >> applications it is useful to monitor the evolution >>> of curves as the >>> >> script >>> >> is running - allows me to update parameters if >>> something diverges. >>> >> Any idea why there is such a difference between >>> 0.98.5.3 and 0.99 ?? >>> >> -- >>> >> View this message in context: >>> >> >>> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html >>> >> Sent from the matplotlib - users mailing list >>> archive at Nabble.com. >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------------ >>> >> Let Crystal Reports handle the reporting - Free >>> Crystal Reports 2008 >>> >> 30-Day >>> >> trial. Simplify your report design, integration >>> and deployment - and >>> >> focus on >>> >> what you do best, core application coding. >>> Discover what's new with >>> >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> >> _______________________________________________ >>> >> Matplotlib-users mailing list >>> >> Mat...@li... >>> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >>> > >>> > >>> ------------------------------------------------------------------------------ >>> > Let Crystal Reports handle the reporting - Free >>> Crystal Reports 2008 >>> > 30-Day >>> > trial. Simplify your report design, integration and >>> deployment - and focus >>> > on >>> > what you do best, core application coding. Discover >>> what's new with >>> > Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> > _______________________________________________ >>> > Matplotlib-users mailing list >>> > Mat...@li... >>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25326025.html >>> Sent from the matplotlib - users mailing list archive at >>> Nabble.com. >>> >>> >>> ------------------------------------------------------------------------------ >>> Let Crystal Reports handle the reporting - Free Crystal >>> Reports 2008 30-Day >>> trial. Simplify your report design, integration and >>> deployment - and focus on >>> what you do best, core application coding. Discover what's >>> new with >>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - and >> focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- View this message in context: http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25333552.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jae-Joon L. <lee...@gm...> - 2009-09-07 21:49:51
|
On Mon, Sep 7, 2009 at 1:02 PM, tva<tv...@br...> wrote: > > Problem solved. The backend was set to Qt4Agg. Once set to TkAgg everything > works. > I don't get it but it works.......... > > I think an explicit call of draw() in the interactive mode (e.g. with ipython -pylab) should update the figure canvas immediately. And this is the behavior I currently observe with Gtk and Wx backend. If the Qt4 backend behaves differently, I guess this is a bug. I don't have the qt4 backend installed, and I hope other developers take a look. -JJ |