[IPython-dev] Fwd: notebook plots via javascript

Fernando Perez fperez.net@gmail....
Sun Jun 3 18:27:12 CDT 2012


Forwarding this from Zoltán to the list, so we can continue the
discussion there.

---------- Forwarded message ----------
From: Zoltán Vörös <zvoros@gmail.com>
Date: Sun, Jun 3, 2012 at 1:12 PM
Subject: notebook plots via javascript
To: Fernando Perez <fperez.net@gmail.com>


Dear Fernando,

I hope you won't mind that I approach you in this way, bypassing the
mailing list. The reason is that I am not sure whether this would
interest many people, or whether this scheme is feasible at all, so I
wanted to have an opinion from the core development team first.

I have raised this issue a couple of times on the mailing list, but
after your announcement yesterday, I started to consider it more
seriously. In short, there seems to be a consensus that interactive
plots are within reach now, and in fact, using flot, it is already
doable. I have played with the flot.py script that you advertised
yesterday. Overall, I was quite impressed, however, I see one very
serious problem with it. At this point, it is not "compatible" with
matplotlib in the sense that one has to write separate scripts for
interactive (flot) and static (matplotlib) plots. I believe, down the
road it is going to be an annoying issue. Of course, one could just
write a wrapper of sort, take matplotlib-like plots, and turn them
into flot-like plots. This is what I started to do, but then I
realised that it might not be worthwhile at all, and perhaps, it is
easier to write a proper javascript backend to matplotlib than a
wrapper for flot.

So, I dug up the documentation and the source of the various backends,
and started to hack something. Based on what I already have, I am
quite convinced that this is not an insurmountable obstacle. I already
have static plots, and adding coordinate reporting, zooming, grid
toggling, and the like should not take me too long. I think, it is
only proper to acknowledge the expertise of John Hunter and his folk,
for they made sure that adding backends is doable, and in fact, it is
not difficult at all.

Now, my question really is whether there would be interest in a
javascript backend. This could be shipped with ipython as a module (it
is going to be something like 30-50 kB of code, depending on what kind
of functionality I implement), and then loaded whenever needed. I
could also make it modular in the sense that one could just have
templates for extra functionality, so one would not have to mess with
the python source itself.

I think, I would need 1-2 weeks for properly cleaning up the code.
Given my schedule, this is a lot of time, and I would probably not
spend it on a project that is used only by me. However, if you think
that there is potential in this approach, I would happily invest some
effort into it. I think I could also commit to maintaining the package
in the long run.

Let me know your opinion!

Cheers,
Zoltán

PS: ipython is becoming more and more amazing by the hour. Many thanks
for your efforts!


More information about the IPython-dev mailing list