[IPython-dev] Interactive Matplotlib in the browser

Jason Grout jason-sage at creativetrax.com
Thu Oct 11 22:06:23 EDT 2012


On 10/11/12 5:50 PM, Jason Grout 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.
>>
>
> A sample implementation using websockets instead of polling is here:
>
> https://gist.github.com/3875846
>
> It still requests the file, which causes a delay.  I think doing a png
> diff sounds like a great idea.  What if we also transfer the png diff
> over the websocket connection (maybe in a binary frame)?

I just updated it to transfer the image over websocket too.  More timing 
tests need to be done to see which approach is better, especially tests 
across a network.  The current version of 
https://gist.github.com/3875846 also transfers over a base64 version of 
the data; it seems like it would be better to transfer it as a binary 
message.

Also, the polling isn't very smart compared to your original example. 
Right now, I have a continuous 50ms refresh, but of course, it should be 
smarter about requesting a refresh only when we know there is a change.

Thanks,

Jason





More information about the IPython-dev mailing list