diff --git a/Plot.ly/.ipynb_checkpoints/Getting_Started_Using_Plotly-checkpoint.ipynb b/Plot.ly/.ipynb_checkpoints/Getting_Started_Using_Plotly-checkpoint.ipynb new file mode 100644 index 0000000..c7ca1e8 --- /dev/null +++ b/Plot.ly/.ipynb_checkpoints/Getting_Started_Using_Plotly-checkpoint.ipynb @@ -0,0 +1,236 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Getting Started with Plot.ly\n", + "\n", + "The graph(s) & code in this notebook are based on the overview/getting started guide for Plot.ly. It's a very nice plotting module for Python, with features you can't find in Matplotlib or Sympy.\n", + "\n", + "https://plot.ly/python/overview/" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Figure(\n", + " data=Data([\n", + " Scatter(\n", + " x=[1, 2, 3, 5, 6],\n", + " y=[1, 4.5, 7, 24, 38],\n", + " mode='markers'\n", + " ),\n", + " Scatter(\n", + " x=[1, 2, 3, 5, 6],\n", + " y=[1, 4, 9, 25, 36],\n", + " mode='lines'\n", + " )\n", + " ]),\n", + " layout=Layout(\n", + " title='Fig 0.3: Some Experiment'\n", + " )\n", + ")\n" + ] + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "from plotly.graph_objs import Data, Figure, Layout, Scatter\n", + "from plotly.offline import download_plotlyjs, init_notebook_mode, iplot\n", + "\n", + "# Configure Plotly to work locally, rather than saving all plots \n", + "# remotely, in my Plot.ly account, through Plot.ly's API.\n", + "init_notebook_mode()\n", + "\n", + "# Make three lists of numbers\n", + "x = [1, 2, 3, 5, 6]\n", + "y1 = [1, 4.5, 7, 24, 38]\n", + "y2 = [1, 4, 9, 25, 36]\n", + "\n", + "# (1.1) Make a 1st Scatter object\n", + "trace1 = Scatter(\n", + " x=x, # x-coordinates of trace\n", + " y=y1, # y-coordinates of trace\n", + " mode='markers' # scatter mode (more in UG section 1)\n", + ")\n", + "\n", + "# (1.2) Make a 2nd Scatter object\n", + "trace2 = Scatter(\n", + " x=x, # same x-coordinates\n", + " y=y2, # different y-coordinates\n", + " mode='lines' # different scatter mode\n", + ") \n", + "\n", + "# (2) Make Data object \n", + "data = Data([trace1, trace2]) # (!) Data is list-like, must use [ ]\n", + "\n", + "# (3) Make Layout object (Layout is dict-like)\n", + "layout = Layout(title='Fig 0.3: Some Experiment')\n", + "\n", + "# (4) Make Figure object (Figure is dict-like)\n", + "fig = Figure(data=data, layout=layout) \n", + "\n", + "# Display pretty-printed dump of the Figure's data\n", + "print(fig.to_string())\n", + "\n", + "py.iplot(fig)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Plot.ly/Getting_Started_Using_Plotly.ipynb b/Plot.ly/Getting_Started_Using_Plotly.ipynb new file mode 100644 index 0000000..c7ca1e8 --- /dev/null +++ b/Plot.ly/Getting_Started_Using_Plotly.ipynb @@ -0,0 +1,236 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Getting Started with Plot.ly\n", + "\n", + "The graph(s) & code in this notebook are based on the overview/getting started guide for Plot.ly. It's a very nice plotting module for Python, with features you can't find in Matplotlib or Sympy.\n", + "\n", + "https://plot.ly/python/overview/" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Figure(\n", + " data=Data([\n", + " Scatter(\n", + " x=[1, 2, 3, 5, 6],\n", + " y=[1, 4.5, 7, 24, 38],\n", + " mode='markers'\n", + " ),\n", + " Scatter(\n", + " x=[1, 2, 3, 5, 6],\n", + " y=[1, 4, 9, 25, 36],\n", + " mode='lines'\n", + " )\n", + " ]),\n", + " layout=Layout(\n", + " title='Fig 0.3: Some Experiment'\n", + " )\n", + ")\n" + ] + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "from plotly.graph_objs import Data, Figure, Layout, Scatter\n", + "from plotly.offline import download_plotlyjs, init_notebook_mode, iplot\n", + "\n", + "# Configure Plotly to work locally, rather than saving all plots \n", + "# remotely, in my Plot.ly account, through Plot.ly's API.\n", + "init_notebook_mode()\n", + "\n", + "# Make three lists of numbers\n", + "x = [1, 2, 3, 5, 6]\n", + "y1 = [1, 4.5, 7, 24, 38]\n", + "y2 = [1, 4, 9, 25, 36]\n", + "\n", + "# (1.1) Make a 1st Scatter object\n", + "trace1 = Scatter(\n", + " x=x, # x-coordinates of trace\n", + " y=y1, # y-coordinates of trace\n", + " mode='markers' # scatter mode (more in UG section 1)\n", + ")\n", + "\n", + "# (1.2) Make a 2nd Scatter object\n", + "trace2 = Scatter(\n", + " x=x, # same x-coordinates\n", + " y=y2, # different y-coordinates\n", + " mode='lines' # different scatter mode\n", + ") \n", + "\n", + "# (2) Make Data object \n", + "data = Data([trace1, trace2]) # (!) Data is list-like, must use [ ]\n", + "\n", + "# (3) Make Layout object (Layout is dict-like)\n", + "layout = Layout(title='Fig 0.3: Some Experiment')\n", + "\n", + "# (4) Make Figure object (Figure is dict-like)\n", + "fig = Figure(data=data, layout=layout) \n", + "\n", + "# Display pretty-printed dump of the Figure's data\n", + "print(fig.to_string())\n", + "\n", + "py.iplot(fig)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}