{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from IPython.core.display import display, HTML\n", "import json\n", "import numpy as np\n", "\n", "def plot3D(X, Y, Z, height=600, xlabel = \"X\", ylabel = \"Y\", zlabel = \"Z\", initialCamera = None):\n", "\n", " options = {\n", " \"width\": \"100%\",\n", " \"style\": \"surface\",\n", " \"showPerspective\": True,\n", " \"showGrid\": True,\n", " \"showShadow\": False,\n", " \"keepAspectRatio\": True,\n", " \"height\": str(height) + \"px\"\n", " }\n", "\n", " if initialCamera:\n", " options[\"cameraPosition\"] = initialCamera\n", " \n", " data = [ {\"x\": X[y,x], \"y\": Y[y,x], \"z\": Z[y,x]} for y in range(X.shape[0]) for x in range(X.shape[1]) ]\n", " visCode = r\"\"\"\n", " \n", " \n", "
\n", " \n", " \n", " \"\"\"\n", " htmlCode = \"\"\n", " display(HTML(htmlCode))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "