[IPython-dev] Interactive Matplotlib in the browser

Jason Grout jason-sage at creativetrax.com
Fri Oct 12 19:16:32 EDT 2012

On 10/12/12 3:53 PM, Brian Granger wrote:
> On Fri, Oct 12, 2012 at 9:35 AM, Jason Grout
> <jason-sage at creativetrax.com> wrote:
>> On 10/11/12 4:49 PM, Michael Droettboom wrote:
>>> I have a proof-of-concept way to make interactive plots in the browser
>>> work using transparent PNGs described here:
>>> http://mdboom.github.com/blog/2012/10/11/matplotlib-in-the-browser-its-coming/
>>> No PRs yet, because this is miles from ready for that, but it would be
>>> helpful to get some feedback about how this works in different
>>> browsers/platforms/network environments etc.
>> I just want to point out that this may be another use-case for custom
>> messages in IPython.  For example, a matplotlib figure, when it is
>> drawn, could send the initial png over the websocket as a display_data
>> message.  Matplotlib would then register a callback with IPython to
>> handle any custom messages coming back from the javascript (routed
>> according to the parent header).  When the javascript detects an event,
>> it sends a message back to IPython, IPython calls the appropriate
>> matplotlib callback, and matplotlib has the chance to send a new figure
>> over.  The javascript side likewise has a callback registered to handle
>> matplotlib's return messages.  These messages back and forth may make
>> sense to have custom message types.
> We can already do this type of round tripping without any custom
> messages.  That is not to say that they wouldn't be useful though,
> they might be.  But they are not required.

Oh good.  What would the message type be from the browser back to 
matplotlib?  A display_data message back to matplotlib?  And how would 
matplotlib be able to act on that message?



More information about the IPython-dev mailing list