|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "#### Basic Wireframe Plot" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": 2, |
| 13 | + "metadata": { |
| 14 | + "collapsed": false |
| 15 | + }, |
| 16 | + "outputs": [ |
| 17 | + { |
| 18 | + "data": { |
| 19 | + "text/html": [ |
| 20 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~demo_account/98.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 21 | + ], |
| 22 | + "text/plain": [ |
| 23 | + "<plotly.tools.PlotlyDisplay object>" |
| 24 | + ] |
| 25 | + }, |
| 26 | + "execution_count": 2, |
| 27 | + "metadata": {}, |
| 28 | + "output_type": "execute_result" |
| 29 | + } |
| 30 | + ], |
| 31 | + "source": [ |
| 32 | + "import plotly.plotly as py\n", |
| 33 | + "import plotly.graph_objs as go\n", |
| 34 | + "\n", |
| 35 | + "import numpy as np\n", |
| 36 | + "\n", |
| 37 | + "# Creating the data\n", |
| 38 | + "x = np.linspace(-5, 5, 50)\n", |
| 39 | + "y = np.linspace(-5, 5, 50)\n", |
| 40 | + "xGrid, yGrid = np.meshgrid(y, x)\n", |
| 41 | + "R = np.sqrt(xGrid ** 2 + yGrid ** 2)\n", |
| 42 | + "z = np.sin(R)\n", |
| 43 | + "\n", |
| 44 | + "# Creating the plot\n", |
| 45 | + "lines = []\n", |
| 46 | + "line_marker = dict(color='#0066FF', width=2)\n", |
| 47 | + "for i, j, k in zip(xGrid, yGrid, z):\n", |
| 48 | + " lines.append(go.Scatter3d(x=i, y=j, z=k, mode='lines', line=line_marker))\n", |
| 49 | + "\n", |
| 50 | + "layout = go.Layout(\n", |
| 51 | + " title='Wireframe Plot',\n", |
| 52 | + " scene=dict(\n", |
| 53 | + " xaxis=dict(\n", |
| 54 | + " gridcolor='rgb(255, 255, 255)',\n", |
| 55 | + " zerolinecolor='rgb(255, 255, 255)',\n", |
| 56 | + " showbackground=True,\n", |
| 57 | + " backgroundcolor='rgb(230, 230,230)'\n", |
| 58 | + " ),\n", |
| 59 | + " yaxis=dict(\n", |
| 60 | + " gridcolor='rgb(255, 255, 255)',\n", |
| 61 | + " zerolinecolor='rgb(255, 255, 255)',\n", |
| 62 | + " showbackground=True,\n", |
| 63 | + " backgroundcolor='rgb(230, 230,230)'\n", |
| 64 | + " ),\n", |
| 65 | + " zaxis=dict(\n", |
| 66 | + " gridcolor='rgb(255, 255, 255)',\n", |
| 67 | + " zerolinecolor='rgb(255, 255, 255)',\n", |
| 68 | + " showbackground=True,\n", |
| 69 | + " backgroundcolor='rgb(230, 230,230)'\n", |
| 70 | + " )\n", |
| 71 | + " ),\n", |
| 72 | + " showlegend=False,\n", |
| 73 | + ")\n", |
| 74 | + "fig = go.Figure(data=lines, layout=layout)\n", |
| 75 | + "py.iplot(fig, filename='wireframe_plot')" |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "cell_type": "markdown", |
| 80 | + "metadata": {}, |
| 81 | + "source": [ |
| 82 | + "#### Reference" |
| 83 | + ] |
| 84 | + }, |
| 85 | + { |
| 86 | + "cell_type": "markdown", |
| 87 | + "metadata": {}, |
| 88 | + "source": [ |
| 89 | + "See https://plot.ly/python/reference/ for more information!" |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "code", |
| 94 | + "execution_count": 3, |
| 95 | + "metadata": { |
| 96 | + "collapsed": false |
| 97 | + }, |
| 98 | + "outputs": [ |
| 99 | + { |
| 100 | + "data": { |
| 101 | + "text/html": [ |
| 102 | + "<link href=\"//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700\" rel=\"stylesheet\" type=\"text/css\" />" |
| 103 | + ], |
| 104 | + "text/plain": [ |
| 105 | + "<IPython.core.display.HTML object>" |
| 106 | + ] |
| 107 | + }, |
| 108 | + "metadata": {}, |
| 109 | + "output_type": "display_data" |
| 110 | + }, |
| 111 | + { |
| 112 | + "data": { |
| 113 | + "text/html": [ |
| 114 | + "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">" |
| 115 | + ], |
| 116 | + "text/plain": [ |
| 117 | + "<IPython.core.display.HTML object>" |
| 118 | + ] |
| 119 | + }, |
| 120 | + "metadata": {}, |
| 121 | + "output_type": "display_data" |
| 122 | + }, |
| 123 | + { |
| 124 | + "name": "stdout", |
| 125 | + "output_type": "stream", |
| 126 | + "text": [ |
| 127 | + "Collecting git+https://github.com/plotly/publisher.git\n", |
| 128 | + " Cloning https://github.com/plotly/publisher.git to /var/folders/j3/gt_q6y096cjfts4q8zq2dm2c0000gn/T/pip-is3Tpx-build\n", |
| 129 | + "Installing collected packages: publisher\n", |
| 130 | + " Found existing installation: publisher 0.10\n", |
| 131 | + " Uninstalling publisher-0.10:\n", |
| 132 | + " Successfully uninstalled publisher-0.10\n", |
| 133 | + " Running setup.py install for publisher\n", |
| 134 | + "Successfully installed publisher-0.10\n" |
| 135 | + ] |
| 136 | + }, |
| 137 | + { |
| 138 | + "name": "stderr", |
| 139 | + "output_type": "stream", |
| 140 | + "text": [ |
| 141 | + "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/nbconvert.py:13: ShimWarning:\n", |
| 142 | + "\n", |
| 143 | + "The `IPython.nbconvert` package has been deprecated. You should import from nbconvert instead.\n", |
| 144 | + "\n", |
| 145 | + "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/publisher/publisher.py:53: UserWarning:\n", |
| 146 | + "\n", |
| 147 | + "Did you \"Save\" this notebook before running this command? Remember to save, always save.\n", |
| 148 | + "\n" |
| 149 | + ] |
| 150 | + } |
| 151 | + ], |
| 152 | + "source": [ |
| 153 | + "from IPython.display import display, HTML\n", |
| 154 | + "\n", |
| 155 | + "display(HTML('<link href=\"//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700\" rel=\"stylesheet\" type=\"text/css\" />'))\n", |
| 156 | + "display(HTML('<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">'))\n", |
| 157 | + "\n", |
| 158 | + "! pip install git+https://github.com/plotly/publisher.git --upgrade\n", |
| 159 | + " \n", |
| 160 | + "import publisher\n", |
| 161 | + "publisher.publish(\n", |
| 162 | + " '3d-wireframe.ipynb', 'python/3d-wireframe-plots/', 'Python Wireframe Plots | plotly',\n", |
| 163 | + " 'How to make wireframe plots in Python',\n", |
| 164 | + " title= '3D Wireframe Plots in Python | plotly',\n", |
| 165 | + " name = 'How to make 3D wireframe plots',\n", |
| 166 | + " has_thumbnail='true', thumbnail='thumbnail/wireframe.jpg', \n", |
| 167 | + " language='python', page_type='example_index', \n", |
| 168 | + " display_as='3d_charts', order=9)" |
| 169 | + ] |
| 170 | + }, |
| 171 | + { |
| 172 | + "cell_type": "code", |
| 173 | + "execution_count": null, |
| 174 | + "metadata": { |
| 175 | + "collapsed": true |
| 176 | + }, |
| 177 | + "outputs": [], |
| 178 | + "source": [] |
| 179 | + } |
| 180 | + ], |
| 181 | + "metadata": { |
| 182 | + "kernelspec": { |
| 183 | + "display_name": "Python 2", |
| 184 | + "language": "python", |
| 185 | + "name": "python2" |
| 186 | + }, |
| 187 | + "language_info": { |
| 188 | + "codemirror_mode": { |
| 189 | + "name": "ipython", |
| 190 | + "version": 2 |
| 191 | + }, |
| 192 | + "file_extension": ".py", |
| 193 | + "mimetype": "text/x-python", |
| 194 | + "name": "python", |
| 195 | + "nbconvert_exporter": "python", |
| 196 | + "pygments_lexer": "ipython2", |
| 197 | + "version": "2.7.9" |
| 198 | + } |
| 199 | + }, |
| 200 | + "nbformat": 4, |
| 201 | + "nbformat_minor": 0 |
| 202 | +} |
0 commit comments