I tried the suggested clean-up but saw no difference in performance.  I
left out a crucial piece of information, I think, in my earlier message.
The delay in drawing occurs when I'm running the code from within
ipython, invoked with the -pylab flag.  When I run it directly from the
command line, I get no such delay.  I presume this is backend dependent.
For my current purposes, just running it directly from the command line
(i.e. something like: % python do_fits.py) works for me.  The ability to
interactively examine variables, as one can when running within ipython,
would be nicer, however.

Jon

>         On 06/24/2011 04:03 AM, Jonathan Slavin wrote:
>         > import matplotlib.pyplot as plt
>         > plt.ion()
>         > fig = plt.gcf()
>         > for obsid in obsids:
>         >      <do fitting>
>         >      plt.cla()
>         >      fig = plt.gcf()
>         >      ax = fig.add_axes([0.15,0.1,0.8,0.6])
>         >      ax.plot(x,y)
>         >      plt.draw()
>         >      ans = raw_input('continue? ')
>         >      if ans == 'n':
>         >          break
>         
>         The behavior may depend on mpl version and backend, but with
>         1.0.1 or 
>         later, I think something like what you have will work with a
>         little 
>         cleanup, e.g.:
>         
>         import matplotlib.pyplot as plt
>         import numpy as np
>         
>         plt.ion()
>         fig = plt.gcf()
>         ax = fig.add_axes([0.15,0.1,0.8,0.6])
>         for i in range(3):
>              ax.cla()
>              ax.plot(np.random.rand(10))
>              plt.draw()
>              raw_input("hit a key to proceed")
>         
>         
>         Eric


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to