[IPython-dev] interactive matplotlib via comm infrastructure
Jason Grout
jason-sage at creativetrax.com
Fri Nov 15 09:07:39 EST 2013
I should probably have cross-posted this:
http://sourceforge.net/mailarchive/message.php?msg_id=31640342
Following a very helpful conversation with Michael yesterday in the
dev hangout, I got the interactive matplotlib working with the current
master (of matplotlib and ipython).
I updated the pull request at
https://github.com/matplotlib/matplotlib/pull/2524
To test this, run IPython (master branch, to get the comm commits), and
put this in a cell:
https://github.com/matplotlib/matplotlib/pull/2524#issuecomment-28539813
Then you can execute something like:
from matplotlib.figure import Figure
import numpy as np
fig = Figure()
a = fig.add_subplot(111)
t = np.arange(0.0, 3.0, 0.01)
s = np.sin(2 * np.pi * t)
a.plot(t, s)
CommFigure(fig)
and get a live figure in the IPython notebook that uses the comm
messaging infrastructure.
I also got this working in the Sage cell server:
http://sagecell.sagemath.org/?q=ilpajg (for a sage plotting example)
http://sagecell.sagemath.org/?q=spadja (for one of the examples from the
matplotlib docs)
Thanks again for everyone's work on the comm infrastructure!
Jason
More information about the IPython-dev
mailing list