[IPython-dev] notebook plots via javascript

Brian Granger ellisonbg at gmail.com
Mon Jun 4 23:52:04 EDT 2012


Hi,

Great discussion!  Some general thoughts:

* I agree that interactive plotting in the notebook is really important.
* I would love to see that emerge out of matplotlib, rather than YAPL
(yet another plotting library).
* Someone is going to have to write very complex JavaScript code (or
we use an existing library) to create and manipulate the plots on the
browser side of things.  As mentioned above, this logic extends far
beyond the low-level primitives that the matplotlib backend API knows
about.  Because of this, I don't think we can approach this as purely
a matplotlib backend.
* Ideally the code produced in this effort would not only work in
IPython, but it would work in IPython.  Given the very specific
architecture of IPython, that is going to be challening.

Based on these observations, I am thinking of something like the following:

* We implement a JSON backend for matplotlib.  Basically, whenever one
of the backend methods is called, it would write to a JSON structure.
At the end of the day, there would be a JSON structure that has the
entire set of drawing primitives and all their details.  This part of
the code would be fully reusable by other "frontends" and would
provide a serialization format for matplotlib.
* We implement a JavaScript plugin/widget that works with the IPython
Notebook that consumes that JSON and creates an interactive plot based
on that information.  This part of the code would be specific to
IPython.

Does this sound reasonable?

Cheers,

Brian

On Mon, Jun 4, 2012 at 10:35 AM, Zoltán Vörös <zvoros at gmail.com> wrote:
> Hi Bob,
>> It seems to me that the majority of this work should actually be in the
>> matplotlib SVG backend.
> This could be the case. I would be OK with that.
>
>> IPython should just throw whatever matplotlib hands it
>> into the notebook.  Why does mplh5canvas require a server?!?
> Because that is how resizing, zooming, coordinate reporting and so on is
> done. As John Hunter pointed out earlier, by the time matplotlib reaches
> the backend, there is no notion of the data objects, there are only
> lines and letters, nothing more. Based on that, it would be hard to know
> how to zoom, e.g.
> Cheers,
> Zoltán
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list