[IPython-dev] datavis with ipython notebook

Chen-Shan Chin cschin at infoecho.net
Tue Feb 7 10:50:17 EST 2012

One of my dilemma now is if I want to leverage the power of the library like d3.js, then I need a more isolated web environment like iframe or a separate window to avoid bad javascript code messing up the notebook itself.  I will look into if it is possible to use ipython notebook to create new zmq/websocket channel for such isolation.


On Feb 7, 2012, at 3:35 AM, hugo wrote:

> when i was playing around with this, I wrote a python module which would call publish_display_data, publish_display_data sends data out over the regular ipython iopub socket. this message maps mime_types to data.  you can create your own mime type.  the ipython notebook currently handles a few different mime types, I extended the notebook code to respond to my mime type and then create the plot in the code cell.
> On 02/07/2012 02:17 AM, Chen-Shan Chin wrote:
>> Thanks.  I have been playing around a number of ideas. I get to the stage that I can write d3.js + python script within the python notebook web interface and send the script through a zmq / websocket server to an IFRAME or a new browser window/tab. I put my preliminary results and some simple instruction at https://github.com/cschin/IPython-Notebook---d3.js-mashup
>> Obviously, there are a lot of interesting things that one can do along this line.  Using an iframe / new browser might not be ideal. The extra zmq/websocket server is also not pretty. Any suggestions?
>> --Jason
>> On Jan 27, 2012, at 2:19 PM, Mark Voorhies wrote:
>>> On Friday, January 27, 2012 02:07:38 pm Mark Voorhies wrote:
>>>> On Friday, January 27, 2012 01:35:04 pm Bartosz Telenczuk wrote:
>>>>> I completely agree, it would be really nice to enable user interaction with the plots in notebooks. If I am not mistaken, Sage has also a similar feature.
>>>>> I have played with dynamic plots in ipython notebook a bit. The idea is that I add some javascript to SVG generated from matlplotlib (based on an example from matplotlib website). It works well for me (in Firefox and Chrome), but the limitation is that currently one cannot feed the data based on user interaction back to the interpreter.
>>>> SVG supports links on elements by putting them inside an anchor element with an xlink:href attribute.
>>>> Firefox supports this (left click to open link in current tab, middle click to open link in new tab, right
>>>> click context menu not supported).  I haven't tested in Chrome, but it is supported in old versions of webkit.
>>>> So, a baroque feedback strategy would be to make localhost GET requests via these links to communicate
>>>> user actions.
>>>> Not sure if the links should point at the tornado instance running the notebook or at a separate server instance
>>>> (which seems cleaner, but also seems prone to threading issues).
>>>> Haven't actually tried this yet, but I've been playing quite a bit with xlink:href and xlink:title in SVG to mark
>>>> up NetworkX outputs.
>>>> --Mark
>>> Here (attached) is an example of xlink:href/xlink:title in an SVG (in this case, linking some gene annotation
>>> databases to a graph of inferred relationships between genes and annotations).
>>> There is a nice description of SVG linking (including links to an element within an SVG with optional transformation)
>>> in chapter 17 of the SVG spec:
>>>   http://www.w3.org/TR/SVG11/linking.html
>>> --Mark
>>>>> I attach my sample notebook for testting (when you click on one of text(!) labels: 'rabbit' or 'frog' some bars should disappear)
>>>>> Bartosz
>>>>> On 27.01.2012, at 18:34, Brian Granger wrote:
>>>>>> We would definitely like to support this but there are some technical
>>>>>> problems with injecting Javascript into the page dynamically that we
>>>>>> will have to work out before this is possible.
>>>>>> On Thu, Jan 26, 2012 at 11:09 PM, Chen-Shan Chin<cschin at infoecho.net>  wrote:
>>>>>>> Hi, All, is it possible to let the backend python process to talk with some good javascript based visualization library running on a browser?  It that works, ipython will be a great tool for developing infovis.  Any comment on this?  I think I might try a little to whether it is feasible.  Or, is there something like that already?
>>>>>>> --Jason Chin
>>>>>>> _______________________________________________
>>>>>>> IPython-dev mailing list
>>>>>>> IPython-dev at scipy.org
>>>>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>>> Bartosz Telenczuk
>>>>> Institute for Theoretical Biology
>>>>> Humboldt University of Berlin, Germany
>>>>> Phone: +4930/2093-8838
>>>>> Homepage: http://neuroscience.telenczuk.pl
>>>>> _______________________________________________
>>>>> IPython-dev mailing list
>>>>> IPython-dev at scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>> -------------- next part --------------
>>> A non-text attachment was scrubbed...
>>> Name: catalases2.svg
>>> Type: image/svg+xml
>>> Size: 142312 bytes
>>> Desc: not available
>>> Url : http://mail.scipy.org/pipermail/ipython-dev/attachments/20120127/ca611993/attachment.bin
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list