[IPython-User] Example/Tutorial of IPython + thread for matplotlib

MinRK benjaminrk@gmail....
Thu Jan 12 15:42:34 CST 2012

On Thu, Jan 12, 2012 at 13:20, Paul Ivanov <pivanov314@gmail.com> wrote:

> Jeremy Conlin, on 2012-01-12 11:52,  wrote:
> > I need to monitor the progress of a calculation and would like to do
> > that by continually updating a matplotlib plot while the rest of the
> > calculation continues. I know this could be done using a separate
> > thread, but I'm not sure how to implement it.
> >
> > Does anyone have—or can point me to—an example or tutorial that can
> > show me how to do this?
> Hi Jeremy,
> you can get the functionality you want by simply starting up
> IPython with --pylab (I believe that the most recent version of
> IPython has a %pylab magic which allows you to do this after
> ipython's been started).
> IPython takes care of this separate thread for you.

You can check
> that it works by doing something as simple as
> In [1]: plt.plot([3,1,4]);
> In [2]: plt.show();
> And then see that you can manipulate the plot with your mouse,
> but still type in new commands at the ipython prompt and have
> them execute. (Without threading, you'd be blocked after the call
> to plt.show() until you closed the figure that pops up).

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.

See the output of `threading.enumerate()` for confirmation - there are only
two threads, main and the background history-save.

> best,
> --
> Paul Ivanov
> 314 address only used for lists,  off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120112/d45332fd/attachment.html 

More information about the IPython-User mailing list