{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# pythreejs\n", "\n", "[pythreejs](https://github.com/jovyan/pythreejs) allows 3D interactive graphs in a notebook."]}, {"cell_type": "markdown", "metadata": {}, "source": ["[documentation](http://threejs.org/docs/index.html#Manual/Introduction/Creating_a_scene) [source](https://github.com/jovyan/pythreejs) [installation](https://github.com/jovyan/pythreejs#installation) [tutorial](https://github.com/jovyan/pythreejs/blob/master/examples/Examples.ipynb) [gallery](http://threejs.org/) "]}, {"cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [{"data": {"text/html": ["
\n", ""], "text/plain": ["Failed to display Jupyter Widget of type Renderer
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n"], "text/plain": ["Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.5, position=(3.0, 5.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), position=(0.0, 5.0, 5.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 0.0, 1.0)), controls=[OrbitControls(controlling=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.5, position=(3.0, 5.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), position=(0.0, 5.0, 5.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 0.0, 1.0)))], scene=Scene(children=(Mesh(geometry=SphereGeometry(), material=MeshLambertMaterial(alphaMap=None, aoMap=None, color='red', emissiveMap=None, envMap=None, lightMap=None, map=None, specularMap=None), position=(2.0, 1.0, 0.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), AmbientLight(color='#777777', quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), Sprite(center=(0.5, 0.5), material=SpriteMaterial(map=TextTexture(repeat=(1.0, 1.0), size=100, squareTexture=False, string='Hello World!')), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 0.6, 1.0), up=(0.0, 1.0, 0.0))), fog=None, overrideMaterial=None, quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), shadowMap=WebGLShadowMap())"]}, "metadata": {}, "output_type": "display_data"}], "source": ["ball = Mesh(geometry=SphereGeometry(radius=1), material=MeshLambertMaterial(color='red'), position=[2,1,0])\n", "scene = Scene(children=[ball, AmbientLight(color='#777777'), make_text('Hello World!', height=.6)])\n", "c = PerspectiveCamera(position=[0, 5, 5],\n", " up=[0, 0, 1],\n", " children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)])\n", "renderer = Renderer(camera=c, scene=scene, controls=[OrbitControls(controlling=c)])\n", "display(renderer)"]}, {"cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [{"data": {"application/vnd.jupyter.widget-view+json": {"model_id": "0affe03e1e5d4fdcbb5a0d0288fd664b", "version_major": 2, "version_minor": 2}, "text/html": ["Failed to display Jupyter Widget of type HTML
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n"], "text/plain": ["HTML(value='Green point at (0.000, 0.000, 0.000)')"]}, "metadata": {}, "output_type": "display_data"}, {"data": {"application/vnd.jupyter.widget-view+json": {"model_id": "a5ad1620be0a44c48312841ecd79b8f6", "version_major": 2, "version_minor": 2}, "text/html": ["Failed to display Jupyter Widget of type Renderer
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n"], "text/plain": ["Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.0, 5.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), position=(0.0, 3.0, 3.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 0.0, 1.0)), controls=[OrbitControls(controlling=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.0, 5.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), position=(0.0, 3.0, 3.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 0.0, 1.0))), Picker(controlling=Group(children=(Mesh(geometry=SurfaceGeometry(attributes={'position':