|
two changes that made it work for me: import numpy as np #import time import pylab as p a = np.arange(10) for x in xrange(5): p.figure() p.plot(a) 1. p.plot(a) instead of p.plot(x): x is just one point so the plot looks a bit empty 2. p.figure() will force matplotlib to open a new figure You could also save the figure (p.savefig()) than optionally close it (p.close()) before moving on the next. Is this solving your problem? Regards, David On 02/03/12 09:04, Jonatan Hjul wrote: I have had the same problem - but I thought it was a problem with matplotlib and not Spyder, so I did not investigate a lot more./Jonatan On 1 Mar., 19:30, Andrew Collette <[email protected]> wrote:Hi, I'm transitioning from using IDL to using Python for analysis. There's one (important) thing I can't get working, which is plotting from a loop or script. The simplest fragment I could find that reproduces the problem is: import numpy as np import time import pylab as p a = np.arange(10) for x in xrange(10): p.plot(x) time.sleep(1) Whether in a .py file or entered manually at the console, the result is the same: a plot window appears but is blank and frozen (won't respond to clicks); when the loop exits, all ten plots suddenly show up in the figure at once. I've tried various combinations of pylab.ion(), draw(), show() with no success. This is a real problem as it's very common in the IDL world to plot many time series one after another, sometimes reading input from the user for each one. For example, I need to manually go through a dataset and throw out the bad traces, using input() in place of the sleep command. Any ideas? I am using Spyder 2.0.13 as part of PythonXY. Thanks, Andrew Collette -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en. |
- [spyder] Plotting from a script or loop with spyder Andrew Collette
- [spyder] Re: Plotting from a script or loop with spyd... Jonatan Hjul
- Re: [spyder] Re: Plotting from a script or loop w... David Verelst
- Re: [spyder] Re: Plotting from a script or lo... Andrew Collette
- Re: [spyder] Re: Plotting from a script o... David Verelst
- [spyder] Re: Plotting from a script or loop with spyd... Chris
- Re: [spyder] Plotting from a script or loop with spyd... Pierre Raybaut
- Re: [spyder] Plotting from a script or loop with ... Andrew Collette
