[IPython-User] Example/Tutorial of IPython + thread for matplotlib
Thu Jan 12 15:20:44 CST 2012
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?
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 : plt.plot([3,1,4]);
In : 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).
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
More information about the IPython-User