<br><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 13:20, Paul Ivanov <span dir="ltr"><<a href="mailto:pivanov314@gmail.com">pivanov314@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Jeremy Conlin, on <a href="tel:2012-01-12%2011" value="+12012011211">2012-01-12 11</a>:52, wrote:<br>
> I need to monitor the progress of a calculation and would like to do<br>
> that by continually updating a matplotlib plot while the rest of the<br>
> calculation continues. I know this could be done using a separate<br>
> thread, but I'm not sure how to implement it.<br>
><br>
> Does anyone have—or can point me to—an example or tutorial that can<br>
> show me how to do this?<br>
<br>
</div>Hi Jeremy,<br>
<br>
you can get the functionality you want by simply starting up<br>
IPython with --pylab (I believe that the most recent version of<br>
IPython has a %pylab magic which allows you to do this after<br>
ipython's been started).<br>
<br>
IPython takes care of this separate thread for you.</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> You can check<br>
that it works by doing something as simple as<br>
<br>
In [1]: plt.plot([3,1,4]);<br>
In [2]: plt.show();<br>
<br>
And then see that you can manipulate the plot with your mouse,<br>
but still type in new commands at the ipython prompt and have<br>
them execute. (Without threading, you'd be blocked after the call<br>
to plt.show() until you closed the figure that pops up).<br></blockquote><div><br></div><div><br class="Apple-interchange-newline">This isn't quite accurate - IPython no longer runs the eventloop in a separate thread as of 0.11. Instead, IPython integrates the eventloop and the inputhook directly.</div>
<div><br></div><div>See the output of `threading.enumerate()` for confirmation - there are only two threads, main and the background history-save.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
best,<br>
<span class="HOEnZb"><font color="#888888">--<br>
Paul Ivanov<br>
314 address only used for lists, off-list direct email at:<br>
<a href="http://pirsquared.org" target="_blank">http://pirsquared.org</a> | GPG/PGP key id: 0x0F3E28F7<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
</div></div></blockquote></div><br>