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

Antonio González Peña antgonza at gmail.com
Mon Jan 19 16:49:31 EST 2015


Hello,

Related to this topic. We maintain Emperor
(http://biocore.github.io/emperor/), a package that uses python to
create very simple THREE.js code that can be embedded as a web page to
visualize and manipulate scatter plots + their metadata. We have
successfully been able to include Emperor plots into IPython notebooks
using _html_repr_. Note that in this case resources are stored in a
server, but we should really be making use of the $NBEXTENSION.

Anyway, as a side note we encountered a small issue with
nbviewer+Emperor: https://github.com/jupyter/nbviewer/issues/316,
which you perhaps might encounter.

Cheers,


On Sun, Jan 18, 2015 at 11:47 PM, David Powell
<DavidAnthonyPowell+python at gmail.com> wrote:
> 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
>
> Another example can be seen at:
>
> http://nbviewer.ipython.org/github/DavidPowell/openmodes-examples/blob/master/Using%20and%20creating%20geometric%20shapes.ipynb
>
> 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
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Antonio



More information about the IPython-dev mailing list