[IPython-dev] Interactive Matplotlib in the browser
Fri Oct 12 12:04:49 CDT 2012
On 10/12/2012 10:28 AM, Michael Droettboom wrote:
> On 10/11/2012 10:06 PM, Jason Grout wrote:
>> 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:
>>>> 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:
>>> 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.
> Thanks. That is very helpful
>> 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
> I see -- just so I'm clear: that's because we send it over a
> websocket, and it's not obvious how else to put the binary data into
> the Canvas Image object on the browser end? I see that that's a bit
> suboptimal. I wonder if it makes sense to use a socket for the event
> communication, but a regular request to get the image data. Then then
> "push" would come from the event websocket as in my original example.
I found a better way -- recent versions of the websockets API do support
binary data. The magic incantation to put load binary data into an
image object is here:
I've created a new github repo for this -- if we're going to collaborate
on this before it develops into a real patch against matplotlib and/or
ipython and/or sage that should be more convenient than using gists.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev