Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## matplotlib-users

 [Matplotlib-users] Replotting inside a while loop From: Tommy Grav - 2007-01-23 18:20:37 ```I have a program that enters a while loop, calculates a bunch of arrays and then plots a figure. The user then looks at the figure and is asked wether the result is ok. If the answer is no, then the calculations are redone and the figure replotted. If the answer is yes then it exits the loop. import pylab as p end = False while not end: (x,y,z) = calculate_arrays() figure(1) subplot(211) plot(x,z) subplot(212) plot(x,y) draw() end = confirm("is the plot ok?") clf() However using the draw() command does not display the figure. How do I do this? I am using Tkagg with numpy on a Mac OS X. Cheers Tommy ```
 Re: [Matplotlib-users] Replotting inside a while loop From: Darren Dale - 2007-01-23 18:28:24 ```On Tuesday 23 January 2007 13:20, Tommy Grav wrote: > I have a program that enters a while loop, calculates a bunch of > arrays and then plots > a figure. The user then looks at the figure and is asked wether the > result is ok. If the > answer is no, then the calculations are redone and the figure > replotted. If the answer is > yes then it exits the loop. > > import pylab as p > > end = False > > while not end: > (x,y,z) = calculate_arrays() > figure(1) > subplot(211) > plot(x,z) > subplot(212) > plot(x,y) > draw() > > end = confirm("is the plot ok?") > clf() > > However using the draw() command does not display the figure. How do > I do this? try "show()" ```
 Re: [Matplotlib-users] Replotting inside a while loop From: Tommy Grav - 2007-01-23 18:39:24 ```On Jan 23, 2007, at 1:28 PM, Darren Dale wrote: > On Tuesday 23 January 2007 13:20, Tommy Grav wrote: >> I have a program that enters a while loop, calculates a bunch of >> arrays and then plots >> a figure. The user then looks at the figure and is asked wether the >> result is ok. If the >> answer is no, then the calculations are redone and the figure >> replotted. If the answer is >> yes then it exits the loop. >> >> import pylab as p >> >> end = False >> >> while not end: >> (x,y,z) = calculate_arrays() >> figure(1) >> subplot(211) >> plot(x,z) >> subplot(212) >> plot(x,y) >> draw() >> >> end = confirm("is the plot ok?") >> clf() >> >> However using the draw() command does not display the figure. How do >> I do this? > > try "show()" While show() does display the figure it does not work for me as it will lock up the script, so it never makes it to the end = confirm() line. Cheers Tommy ```
 Re: [Matplotlib-users] Replotting inside a while loop From: Ted Drain - 2007-01-23 18:53:40 ```See the docs on interactive mode... http://matplotlib.sourceforge.net/interactive.html At 10:39 AM 1/23/2007, Tommy Grav wrote: >On Jan 23, 2007, at 1:28 PM, Darren Dale wrote: > > > On Tuesday 23 January 2007 13:20, Tommy Grav wrote: > >> I have a program that enters a while loop, calculates a bunch of > >> arrays and then plots > >> a figure. The user then looks at the figure and is asked wether the > >> result is ok. If the > >> answer is no, then the calculations are redone and the figure > >> replotted. If the answer is > >> yes then it exits the loop. > >> > >> import pylab as p > >> > >> end = False > >> > >> while not end: > >> (x,y,z) = calculate_arrays() > >> figure(1) > >> subplot(211) > >> plot(x,z) > >> subplot(212) > >> plot(x,y) > >> draw() > >> > >> end = confirm("is the plot ok?") > >> clf() > >> > >> However using the draw() command does not display the figure. How do > >> I do this? > > > > try "show()" > >While show() does display the figure it does not work for me as it >will lock >up the script, so it never makes it to the end = confirm() line. > >Cheers > Tommy > >------------------------------------------------------------------------- >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@... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```