[IPython-dev] WebGL example in IPython notebook based on three.js

Soumith Chintala soumith at fb.com
Mon Jan 19 01:50:30 EST 2015


This is fantastic! I was going to do some of this work myself over the next month for iTorch (https://github.com/facebook/iTorch), and you saved me some trouble.
I will take a look at your code over the next couple of days, I am wondering if you would have any issues if I directly adapted your javascript side of things in iTorch rather than rewriting from scratch.
—
Soumith

From: David Powell <DavidAnthonyPowell+python at gmail.com<mailto:DavidAnthonyPowell+python at gmail.com>>
Reply-To: IPython developers list <ipython-dev at scipy.org<mailto:ipython-dev at scipy.org>>
Date: Sunday, January 18, 2015 at 10:47 PM
To: IPython developers list <ipython-dev at scipy.org<mailto:ipython-dev at scipy.org>>
Subject: [IPython-dev] WebGL example in IPython notebook based on three.js

Hello all,

I recently managed to get 3D vector plots working in the IPython notebook, by statically producing three.js output. I thought I'd share it here in case this example is useful for anyone else, or if anyone has any suggestions as to how I could do things better.

The advantage of the static approach is that the output survives the nbconvert process, which you can see in this notebook here (which also compares with a couple of other unsatisfactory ways of visualising 3D vector plots).

http://nbviewer.ipython.org/github/DavidPowell/openmodes-examples/blob/master/How%20to%20create%203D%20plots.ipynb<https://urldefense.proofpoint.com/v1/url?u=http://nbviewer.ipython.org/github/DavidPowell/openmodes-examples/blob/master/How%2520to%2520create%25203D%2520plots.ipynb&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=5S5uukCkPxLR1dZ0syN0fw%3D%3D%0A&m=70WnYrYAO8zL773kKr3zku5qmdNjduxrZK8pOaiqCaE%3D%0A&s=aad5ead78a1b3391d5b9c2a10e1214ef17fd7df8d223ad6076c6b78f9ff1246c>

Another example can be seen at:

http://nbviewer.ipython.org/github/DavidPowell/openmodes-examples/blob/master/Using%20and%20creating%20geometric%20shapes.ipynb<https://urldefense.proofpoint.com/v1/url?u=http://nbviewer.ipython.org/github/DavidPowell/openmodes-examples/blob/master/Using%2520and%2520creating%2520geometric%2520shapes.ipynb&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=5S5uukCkPxLR1dZ0syN0fw%3D%3D%0A&m=70WnYrYAO8zL773kKr3zku5qmdNjduxrZK8pOaiqCaE%3D%0A&s=76948f7a6b29f01f0eccbe0899c7d91d427a1c1588d11ecbc4e568f992fddea7>

If you are interested to see how this works, you can check out the python source:

https://github.com/DavidPowell/OpenModes/blob/master/openmodes/ipython.py

As well as the javascript:

https://github.com/DavidPowell/OpenModes/blob/master/openmodes/static/three_js_plot.js

and finally the HTML:

https://github.com/DavidPowell/OpenModes/blob/master/openmodes/templates/three_js_plot.html

By the way, I am aware of the efforts to make a proper three.js IPython widget (https://github.com/jasongrout/pythreejs/), and will probably switch over to this once it is stable, and when the output can survive ipython's nbconvert process. Is this something we can expect for widgets in IPython 3.0?

regards
David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150119/1a95b887/attachment.html>


More information about the IPython-dev mailing list