[IPython-dev] Interactive Matplotlib in the browser

Michael Droettboom mdroe at stsci.edu
Thu Oct 11 19:57:40 EDT 2012


On 10/11/2012 06:14 PM, Jason Grout wrote:
> On 10/11/12 5:08 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.
>> When I try to run this with matplotlib 1.1.0, I get:
>>
>> Traceback (most recent call last):
>>      File
>> "/Users/grout/sage-trees/sage-5.4.rc1/local/lib/python2.7/site-packages/tornado-2.4-py2.7.egg/tornado/web.py",
>> line 1042, in _execute
>>        getattr(self, self.request.method.lower())(*args, **kwargs)
>>      File "/Users/grout/projects/matplotlib-live/serve_figure.py", line
>> 174, in get
>>        np.frombuffer(renderer.buffer_rgba(), dtype=np.uint32),
>> TypeError: buffer_rgba() takes exactly 3 arguments (1 given)
>>
>> and the image doesn't show up.  Is this something that is fixed in an
>> matplotlib upgrade?
>>
> Making the call buffer_rgba(0,0) seems to fix it:
>
> https://gist.github.com/3875846
>
Ah, yes.  That API was changed since 1.1.  Your fix is fine for 1.1, but 
it will need to be changed for 1.2.

Mike



More information about the IPython-dev mailing list