Skip to content

Instantly share code, notes, and snippets.

@msund
Last active June 6, 2016 12:08
Show Gist options
  • Save msund/11349097 to your computer and use it in GitHub Desktop.
Save msund/11349097 to your computer and use it in GitHub Desktop.
All of 'em
{
"metadata": {
"name": "Three new matplotlib plots"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "20 Interactive Plots from matplotlib, prettyplotlib, Stack Overflow, and seaborn"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "In this Notebook, we'll create interactive Plotly graphs from different Python libraries. It's easy, lets you collaborate, makes a D3 graph with a URL for you, and stores your data and graphs together. You can also always access the data from your graphs or any public Plotly graph. For a full walk-through and documentation, check out our [getting started Notebook](http://nbviewer.ipython.org/github/etpinard/plotly-python-doc/blob/1.0/s0_getting-started/s0_getting-started.ipynb). Let's set up our environment and packages."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%matplotlib inline\nimport matplotlib.pyplot as plt # side-stepping mpl backend\nimport matplotlib.gridspec as gridspec # subplots\nimport numpy as np",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 12
},
{
"cell_type": "code",
"collapsed": false,
"input": "import plotly.plotly as py\nimport plotly.tools as tls\nfrom plotly.graph_objs import *\n# py.sign_in(\"IPython.Demo\", \"1fw3zw2o13\")",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": "# tls.set_credentials_file(\"IPython.Demo\", \"1fw3zw2o13\")\n# tls.get_credentials_file()",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": "import plotly\nplotly.__version__",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"text": "'1.0.0'"
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": "I. Plotly for Teaching: Software Carpentry Notebook"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "These first two are drawn from the [Software Carpentry repo](http://nbviewer.ipython.org/github/swcarpentry/notebooks/blob/master/matplotlib.ipynb). First, we'll draw a matplotlib figure and show both the matplotlib figure and the Plotly graph."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig1 = plt.figure()\n\n#generate some data\nx = np.array(range(20))\ny = 3 + 0.5 * x + np.random.randn(20)\n\n#plot the data\nplt.plot(x, y, 'bo')\n\n#generate a mpl figure and Plotly figure\nplt.show()\npy.iplot_mpl(fig1)",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAECCAYAAAAMxDf2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAETZJREFUeJzt3X9sU+Uex/FPt6HpfhAUyjIQNhJN1AjT/YExuAxz5/5A\nQmJsiKjFARHBgCTAkvFDIUJE/EWiE9ARzbWEGB1gQIPx3kGcgMkMf9yBsBiDaEYIdsjMvCwy6Ll/\n7Hbyc+tpz9npefp+/UXLSr95aD99dvo8zzdgWZYlAICv5XhdAAAgfYQ5ABiAMAcAAxDmAGAAwhwA\nDECYA4ABBg3z1tZWRSKRq+7bu3evnnzySdeKAgDYkzfQXzY2NmrPnj0qKCjov+/48ePauXOn64UB\nAJI34My8tLRUDQ0NSuwrOn/+vDZt2qSVK1eKvUYAkDkGDPOamhrl5uZKkuLxuFatWqX6+nrl5+cP\nSXEAgOQk/QXosWPH9Ouvv2rt2rVatmyZfvrpJ23YsMHN2gAASRrwmvmVJk2apC+++EKSdPr0aS1d\nulQrVqwY9HGWZSkQCKReIQBgUEmF+bVhbCegA4GAYrFu+5XhhkKhIsbTIYylsxhPZ4VCRbZ+PjAU\npybyH+wc3jDOYSydxXg6y26Ys2kIAAxAmAOAAQhzADAAYQ4ABiDMAcAAhDkAGIAwBwADEOYAYADC\nHAAMQJgDgAEIcwAwAGEOAAYgzAHAAIQ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HAAP8D8s6msCB5sF+AAAAAElFTkSuQmCC\n",
"text": "<matplotlib.figure.Figure at 0x10e073fd0>"
},
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3312\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e088410>"
}
],
"prompt_number": 16
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Now let's draw another figure. This time, we'll only print the converted Plotly version of the figure. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "x = np.array(range(20))\ny = 3 + 0.5 * x + np.random.randn(20)\nz = 2 + 0.9 * x + np.random.randn(20)",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig2 = plt.figure()\n\n#plot the data\nplt.plot(x, y, 'bo')\nplt.hold(True)\nplt.plot(x, z, 'r^')\n\npy.iplot_mpl(fig2)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3313\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e09c4d0>"
}
],
"prompt_number": 18
},
{
"cell_type": "markdown",
"metadata": {},
"source": "One special Plotly feature is that you'll get a URL for your call. The data always lives with the graph. The graph we just made is here:\n\nhttps://plot.ly/~IPython.Demo/3080\n\nAnd I've gone in to make a copy of the graph, and shared the data here:\n\nhttps://plot.ly/~MattSundquist/1190"
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "II. matplotlib Gallery graphs"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "For matplotlib experts, you'll recognize these graphs from the [matplotlib gallery](matplotlib.org/gallery.html). \n\nIn addition to matplotlib and Plotly's own Python API, You can also use Plotly's other [APIs](https://plot.ly/api) for MATLAB, R, Perl, Julia, and REST to write to graphs. That means you and I could edit the same graph with any language. We can even edit the graph and data from the GUI, so technical and non-technical teams can work together. And all the graphs go to your profile, like this: https://plot.ly/~IPython.Demo.\n\nYou control [the privacy](http://plot.ly/python/privacy) by setting `world_readable` to =false or =true, and can control your [sharing](http://plot.ly/python/file-sharing)."
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Plotly also reads the label types in this [damped oscillation](http://matplotlib.org/examples/pylab_examples/legend_demo2.html) graph."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig3 = plt.figure()\n# Make a legend for specific lines.\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n\nt1 = np.arange(0.0, 2.0, 0.1)\nt2 = np.arange(0.0, 2.0, 0.01)\n\n# note that plot returns a list of lines. The \"l1, = plot\" usage\n# extracts the first element of the list into l1 using tuple\n# unpacking. So l1 is a Line2D instance, not a sequence of lines\nl1, = plt.plot(t2, np.exp(-t2))\nl2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--go', t1, np.log(1 + t1), '.')\nl4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 'rs-.')\n\nplt.xlabel('time')\nplt.ylabel('volts')\nplt.title('Damped oscillation')\n\n\npy.iplot_mpl(fig3, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3314\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e5deb50>"
}
],
"prompt_number": 19
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Here's where this gets special. You can get the data from any Plotly graph. That means you can re-plot the graph or part of it, or use your favorite Python tools to wrangle and analyze your data. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "print tls.mpl_to_plotly(fig3).get_data()",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "[{'y': [1.0, 0.99004983374916811, 0.98019867330675525, 0.97044553354850815, 0.96078943915232318, 0.95122942450071402, 0.94176453358424872, 0.93239381990594827, 0.92311634638663576, 0.91393118527122819, 0.90483741803595952, 0.89583413529652822, 0.88692043671715748, 0.8780954309205613, 0.86935823539880586, 0.86070797642505781, 0.85214378896621135, 0.8436648165963837, 0.835270211411272, 0.82695913394336229, 0.81873075307798182, 0.81058424597018708, 0.80251879796247849, 0.79453360250333405, 0.78662786106655347, 0.77880078307140488, 0.77105158580356625, 0.76337949433685315, 0.75578374145572547, 0.74826356757856527, 0.74081822068171788, 0.73344695622428924, 0.72614903707369094, 0.71892373343192617, 0.71177032276260965, 0.70468808971871344, 0.69767632607103103, 0.69073433063735468, 0.68386140921235583, 0.67705687449816465, 0.67032004603563933, 0.6636502501363194, 0.65704681981505675, 0.65050909472331653, 0.64403642108314141, 0.63762815162177333, 0.63128364550692595, 0.62500226828270078, 0.61878339180614084, 0.61262639418441611, 0.60653065971263342, 0.6004955788122659, 0.59452054797019438, 0.58860496967835518, 0.58274825237398964, 0.57694981038048665, 0.57120906384881487, 0.56552543869953709, 0.55989836656540204, 0.5543272847345071, 0.54881163609402639, 0.54335086907449981, 0.53794443759467447, 0.53259180100689718, 0.52729242404304855, 0.52204577676101604, 0.51685133449169918, 0.51170857778654244, 0.50661699236558955, 0.50157606906605545, 0.49658530379140947, 0.4916441974609651, 0.48675225595997168, 0.48190899009020244, 0.47711391552103438, 0.47236655274101469, 0.46766642700990924, 0.46301306831122807, 0.45840601130522352, 0.45384479528235583, 0.44932896411722156, 0.44485806622294111, 0.44043165450599925, 0.43604928632153556, 0.43171052342907973, 0.42741493194872671, 0.42316208231774882, 0.418951549247639, 0.41478291168158138, 0.4106557527523455, 0.40656965974059911, 0.40252422403363597, 0.39851904108451414, 0.39455371037160109, 0.39062783535852108, 0.38674102345450118, 0.38289288597511206, 0.37908303810339883, 0.37531109885139957, 0.37157669102204571, 0.36787944117144233, 0.36421897957152333, 0.3605949401730783, 0.35700696056914738, 0.35345468195878016, 0.34993774911115533, 0.3464558103300574, 0.34300851741870664, 0.33959552564493911, 0.33621649370673334, 0.33287108369807955, 0.32955896107518906, 0.32627979462303947, 0.32303325642225289, 0.31981902181630384, 0.31663676937905316, 0.31348618088260533, 0.31036694126548503, 0.30727873860113125, 0.30422126406670408, 0.30119421191220214, 0.29819727942988739, 0.29523016692401421, 0.29229257768085942, 0.28938421793905061, 0.28650479686019009, 0.2836540264997704, 0.28083162177837978, 0.27803730045319414, 0.27527078308975234, 0.27253179303401259, 0.26982005638468681, 0.26713530196585034, 0.26447726129982396, 0.26184566858032599, 0.25924026064589151, 0.25666077695355588, 0.25410695955280027, 0.25157855305975646, 0.24907530463166816, 0.24659696394160643, 0.24414328315343711, 0.24171401689703645, 0.23930892224375455, 0.23692775868212176, 0.23457028809379765, 0.23223627472975883, 0.22992548518672384, 0.22763768838381274, 0.22537265553943872, 0.22313016014842982, 0.2209099779593782, 0.21871188695221475, 0.21653566731600707, 0.21438110142697794, 0.21224797382674304, 0.21013607120076472, 0.20804518235702046, 0.20597509820488344, 0.20392561173421342, 0.20189651799465538, 0.19988761407514449, 0.19789869908361465, 0.19592957412690934, 0.19398004229089189, 0.19204990862075408, 0.1901389801015205, 0.1882470656387468, 0.18637397603940997, 0.18451952399298926, 0.18268352405273466, 0.1808657926171221, 0.17906614791149322, 0.17728440996987782, 0.17552040061699686, 0.17377394345044514, 0.17204486382305054, 0.17033298882540943, 0.1686381472685955, 0.16696016966704069, 0.16529888822158653, 0.16365413680270405, 0.16202575093388075, 0.16041356777517274, 0.15881742610692068, 0.15723716631362761, 0.15567263036799731, 0.1541236618151314, 0.15259010575688386, 0.15107180883637084, 0.14956861922263504, 0.14808038659546244, 0.14660696213035015, 0.14514819848362373, 0.14370394977770293, 0.14227407158651359, 0.140858420921045, 0.13945685621505094, 0.13806923731089282, 0.13669542544552385], 'x': [0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99], 'name': '_line0'}, {'y': [0.0, 0.062790519529313374, 0.12533323356430426, 0.1873813145857246, 0.24868988716485479, 0.3090169943749474, 0.36812455268467792, 0.42577929156507272, 0.48175367410171532, 0.53582679497899666, 0.58778525229247314, 0.63742398974868963, 0.68454710592868862, 0.72896862742141155, 0.77051324277578925, 0.80901699437494734, 0.84432792550201508, 0.87630668004386369, 0.90482705246601958, 0.92977648588825135, 0.95105651629515353, 0.96858316112863108, 0.98228725072868861, 0.99211470131447788, 0.99802672842827156, 1.0, 0.99802672842827156, 0.99211470131447776, 0.98228725072868861, 0.96858316112863119, 0.95105651629515364, 0.92977648588825135, 0.90482705246601947, 0.87630668004386347, 0.84432792550201496, 0.80901699437494745, 0.77051324277578925, 0.72896862742141155, 0.68454710592868884, 0.63742398974868986, 0.58778525229247325, 0.53582679497899666, 0.4817536741017156, 0.42577929156507288, 0.36812455268467814, 0.30901699437494751, 0.24868988716485479, 0.18738131458572455, 0.12533323356430454, 0.062790519529313582, 1.2246467991473532e-16, -0.062790519529313332, -0.12533323356430431, -0.18738131458572477, -0.24868988716485502, -0.30901699437494773, -0.36812455268467836, -0.42577929156507272, -0.48175367410171499, -0.53582679497899643, -0.58778525229247303, -0.63742398974868963, -0.68454710592868873, -0.72896862742141133, -0.77051324277578936, -0.80901699437494734, -0.8443279255020153, -0.87630668004386358, -0.9048270524660198, -0.92977648588825146, -0.95105651629515353, -0.96858316112863097, -0.98228725072868872, -0.99211470131447776, -0.99802672842827156, -1.0, -0.99802672842827156, -0.99211470131447788, -0.98228725072868872, -0.96858316112863108, -0.95105651629515364, -0.92977648588825124, -0.90482705246601958, -0.87630668004386336, -0.84432792550201552, -0.80901699437494756, -0.77051324277578959, -0.72896862742141155, -0.68454710592868895, -0.63742398974868963, -0.58778525229247325, -0.53582679497899632, -0.48175367410171532, -0.42577929156507222, -0.36812455268467781, -0.30901699437494762, -0.24868988716485535, -0.18738131458572468, -0.12533323356430467, -0.062790519529313263, -2.4492935982947064e-16, 0.062790519529312763, 0.12533323356430418, 0.18738131458572421, 0.24868988716485491, 0.30901699437494717, 0.36812455268467825, 0.4257792915650726, 0.48175367410171571, 0.53582679497899666, 0.58778525229247369, 0.63742398974868997, 0.68454710592868928, 0.72896862742141177, 0.77051324277578925, 0.80901699437494778, 0.84432792550201474, 0.87630668004386314, 0.90482705246601935, 0.92977648588825113, 0.95105651629515342, 0.96858316112863097, 0.98228725072868861, 0.99211470131447776, 0.99802672842827156, 1.0, 0.99802672842827156, 0.99211470131447788, 0.98228725072868861, 0.96858316112863108, 0.95105651629515364, 0.92977648588825168, 0.90482705246601924, 0.87630668004386347, 0.84432792550201508, 0.80901699437494767, 0.77051324277578859, 0.728968627421411, 0.68454710592868839, 0.63742398974868963, 0.58778525229247336, 0.53582679497899721, 0.48175367410171616, 0.42577929156507394, 0.36812455268467797, 0.30901699437494778, 0.24868988716485549, 0.18738131458572568, 0.1253332335643039, 0.062790519529313374, 3.6739403974420594e-16, -0.062790519529312652, -0.12533323356430318, -0.18738131458572496, -0.24868988716485474, -0.30901699437494706, -0.36812455268467725, -0.42577929156507327, -0.4817536741017156, -0.53582679497899666, -0.5877852522924728, -0.63742398974869052, -0.68454710592868917, -0.72896862742141177, -0.77051324277578914, -0.80901699437494723, -0.84432792550201563, -0.87630668004386303, -0.90482705246601891, -0.92977648588825135, -0.95105651629515342, -0.96858316112863097, -0.9822872507286885, -0.99211470131447788, -0.99802672842827156, -1.0, -0.99802672842827156, -0.99211470131447799, -0.98228725072868861, -0.96858316112863119, -0.95105651629515375, -0.92977648588825168, -0.90482705246601924, -0.87630668004386347, -0.84432792550201519, -0.80901699437494767, -0.77051324277578859, -0.72896862742141111, -0.6845471059286885, -0.63742398974868975, -0.58778525229247347, -0.53582679497899577, -0.48175367410171627, -0.42577929156507405, -0.36812455268467809, -0.3090169943749479, -0.2486898871648556, -0.18738131458572582, -0.12533323356430404, -0.062790519529313499], 'name': '_line1', 'x': [0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99]}, {'y': [0.0, 0.095310179804324935, 0.18232155679395459, 0.26236426446749106, 0.33647223662121289, 0.40546510810816438, 0.47000362924573563, 0.53062825106217049, 0.58778666490211906, 0.64185388617239469, 0.69314718055994529, 0.74193734472937733, 0.78845736036427028, 0.83290912293510388, 0.87546873735390007, 0.91629073187415511, 0.95551144502743635, 0.99325177301028345, 1.0296194171811581, 1.0647107369924285], 'name': '_line2', 'x': [0.0, 0.10000000000000001, 0.20000000000000001, 0.30000000000000004, 0.40000000000000002, 0.5, 0.60000000000000009, 0.70000000000000007, 0.80000000000000004, 0.90000000000000002, 1.0, 1.1000000000000001, 1.2000000000000002, 1.3, 1.4000000000000001, 1.5, 1.6000000000000001, 1.7000000000000002, 1.8, 1.9000000000000001]}, {'y': [0.0, 0.062165743421020596, 0.12285146926097672, 0.18184335981016436, 0.23893861721197537, 0.29394605772022159, 0.34668664765999591, 0.39699398009920667, 0.4447146914951135, 0.48970881783523779, 0.53185009004393646, 0.57102616867378042, 0.60713881814373882, 0.64010402102317443, 0.66985203309097185, 0.69632738012194328, 0.71948879756726813, 0.73930911450139214, 0.75577508340393029, 0.76888715753105119, 0.77865921780605296, 0.78511825132287161, 0.78830398370865495, 0.78826846773191139, 0.78507563067078134, 0.77880078307140488, 0.76953009162896391, 0.75736001901360417, 0.74239673353998659, 0.72475549164263386, 0.70455999616952891, 0.68194173354365373, 0.65703929286642604, 0.62999767004847074, 0.60096756005205387, 0.5701046403160569, 0.53756884840888908, 0.50352365691755985, 0.46813534853263294, 0.43157229422939808, 0.39400423737576057, 0.35560158651755347, 0.31653471950275153, 0.27697330150793059, 0.23708561942387243, 0.19703793494301369, 0.15699385857013562, 0.11711374664987216, 0.077554123370951619, 0.038467129568209538, 7.42785831001809e-17, -0.037705429368677892, -0.074513182697526562, -0.11029357299002086, -0.14492359712840394, -0.178287296308974, -0.21027608111877885, -0.24078902065151586, -0.26973309521643124, -0.2970234123487005, -0.32258338598257219, -0.34634487879888559, -0.36824830790587049, -0.38824271415589529, -0.40628579554051591, -0.42234390524133192, -0.43639201504432457, -0.44841364495009212, -0.45840075993135643, -0.46635363490187992, -0.47228068906722837, -0.47619829092729044, -0.47813053529290755, -0.47810899376410282, -0.47617244019506066, -0.47236655274101469, -0.46674359414443878, -0.45936207197229401, -0.45028638056251219, -0.43958642647636065, -0.42733723928383482, -0.41361856953180914, -0.39851447575939558, -0.38211290243192081, -0.36450525066426415, -0.34578594359613163, -0.32605198826640425, -0.30540253581112531, -0.28393844178030153, -0.26176182833265149, -0.23897565002509305, -0.21568326486535064, -0.19198801224195713, -0.16799279928639099, -0.14379969715753954, -0.11950954866940107, -0.095221588609376448, -0.071033078016965234, -0.047038953611618299, -0.023331493474257361, -9.0104476020544775e-17, 0.022869498949732101, 0.045194529858818715, 0.066896433587700643, 0.087900604974218713, 0.10813671144866356, 0.1275388902027601, 0.14604592354732276, 0.16360139218795283, 0.18015380624195493, 0.19565671391234482, 0.21006878782598024, 0.22335388913220877, 0.23548110954559864, 0.24642479160106115, 0.2561645274716351, 0.26468513677815952, 0.27197662389572586, 0.27803411533393801, 0.2828577778364218, 0.28645271790948318, 0.28882886355015802, 0.29000082899996177, 0.28998776340228466, 0.28881318428848463, 0.28650479686019009, 0.28309430007307207, 0.2786171805603177, 0.27311249546219446, 0.26662264525142604, 0.25919313766259983, 0.25087234384752405, 0.24171124788738035, 0.23176319079674212, 0.22108361015411482, 0.20972977648871718, 0.19776052754383772, 0.18523600152343281, 0.17221737041078325, 0.15876657442618819, 0.14494605866497509, 0.13081851292775601, 0.1164466157220316, 0.10189278337814718, 0.087218925183439405, 0.072486205396410944, 0.057754812958130106, 0.043083739671049108, 0.028530567566246629, 0.014151266129022342, 8.1976690925703258e-17, -0.013871052285278363, -0.027411868010671404, -0.040574737996370604, -0.053314411924152427, -0.065588230934112562, -0.077356247213697008, -0.088581330357498655, -0.099229260333664276, -0.10926880694967485, -0.11867179576646029, -0.1274131604651251, -0.13547098172474095, -0.14282651272255487, -0.14946419141933984, -0.15537163984234573, -0.16053965062618583, -0.16496216111788936, -0.16863621539611176, -0.17156191459597445, -0.1737423559701157, -0.17518356115312753, -0.17589439413055735, -0.17588646944497877, -0.17517405120020096, -0.17377394345044514, -0.17170537258420662, -0.16898986233252339, -0.16565110204844838, -0.16171480891867487, -0.1572085847794841, -0.15216176821749336, -0.14660528264109668, -0.14057148101105291, -0.13409398791842592, -0.12720753969508478, -0.11994782323628231, -0.11235131420653809, -0.10445511528922737, -0.096296795127030863, -0.087914228584813431, -0.079345438948697292, -0.070628442655187362, -0.061801097122304069, -0.052900952230938332, -0.043965105979150605, -0.035030064805074417, -0.026131609045568792, -0.017304663967931452, -0.0085831767810049826], 'name': '_line3', 'x': [0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99]}]\n"
}
],
"prompt_number": 20
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Or you can get the string to produce the graph using Plotly."
},
{
"cell_type": "code",
"collapsed": false,
"input": "print tls.mpl_to_plotly(fig3).to_string(pretty = False)",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "Figure(\n data=Data([\n Scatter(\n x=[0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99],\n y=[1.0, 0.99004983374916811, 0.98019867330675525, 0.97044553354850815, 0.96078943915232318, 0.95122942450071402, 0.94176453358424872, 0.93239381990594827, 0.92311634638663576, 0.91393118527122819, 0.90483741803595952, 0.89583413529652822, 0.88692043671715748, 0.8780954309205613, 0.86935823539880586, 0.86070797642505781, 0.85214378896621135, 0.8436648165963837, 0.835270211411272, 0.82695913394336229, 0.81873075307798182, 0.81058424597018708, 0.80251879796247849, 0.79453360250333405, 0.78662786106655347, 0.77880078307140488, 0.77105158580356625, 0.76337949433685315, 0.75578374145572547, 0.74826356757856527, 0.74081822068171788, 0.73344695622428924, 0.72614903707369094, 0.71892373343192617, 0.71177032276260965, 0.70468808971871344, 0.69767632607103103, 0.69073433063735468, 0.68386140921235583, 0.67705687449816465, 0.67032004603563933, 0.6636502501363194, 0.65704681981505675, 0.65050909472331653, 0.64403642108314141, 0.63762815162177333, 0.63128364550692595, 0.62500226828270078, 0.61878339180614084, 0.61262639418441611, 0.60653065971263342, 0.6004955788122659, 0.59452054797019438, 0.58860496967835518, 0.58274825237398964, 0.57694981038048665, 0.57120906384881487, 0.56552543869953709, 0.55989836656540204, 0.5543272847345071, 0.54881163609402639, 0.54335086907449981, 0.53794443759467447, 0.53259180100689718, 0.52729242404304855, 0.52204577676101604, 0.51685133449169918, 0.51170857778654244, 0.50661699236558955, 0.50157606906605545, 0.49658530379140947, 0.4916441974609651, 0.48675225595997168, 0.48190899009020244, 0.47711391552103438, 0.47236655274101469, 0.46766642700990924, 0.46301306831122807, 0.45840601130522352, 0.45384479528235583, 0.44932896411722156, 0.44485806622294111, 0.44043165450599925, 0.43604928632153556, 0.43171052342907973, 0.42741493194872671, 0.42316208231774882, 0.418951549247639, 0.41478291168158138, 0.4106557527523455, 0.40656965974059911, 0.40252422403363597, 0.39851904108451414, 0.39455371037160109, 0.39062783535852108, 0.38674102345450118, 0.38289288597511206, 0.37908303810339883, 0.37531109885139957, 0.37157669102204571, 0.36787944117144233, 0.36421897957152333, 0.3605949401730783, 0.35700696056914738, 0.35345468195878016, 0.34993774911115533, 0.3464558103300574, 0.34300851741870664, 0.33959552564493911, 0.33621649370673334, 0.33287108369807955, 0.32955896107518906, 0.32627979462303947, 0.32303325642225289, 0.31981902181630384, 0.31663676937905316, 0.31348618088260533, 0.31036694126548503, 0.30727873860113125, 0.30422126406670408, 0.30119421191220214, 0.29819727942988739, 0.29523016692401421, 0.29229257768085942, 0.28938421793905061, 0.28650479686019009, 0.2836540264997704, 0.28083162177837978, 0.27803730045319414, 0.27527078308975234, 0.27253179303401259, 0.26982005638468681, 0.26713530196585034, 0.26447726129982396, 0.26184566858032599, 0.25924026064589151, 0.25666077695355588, 0.25410695955280027, 0.25157855305975646, 0.24907530463166816, 0.24659696394160643, 0.24414328315343711, 0.24171401689703645, 0.23930892224375455, 0.23692775868212176, 0.23457028809379765, 0.23223627472975883, 0.22992548518672384, 0.22763768838381274, 0.22537265553943872, 0.22313016014842982, 0.2209099779593782, 0.21871188695221475, 0.21653566731600707, 0.21438110142697794, 0.21224797382674304, 0.21013607120076472, 0.20804518235702046, 0.20597509820488344, 0.20392561173421342, 0.20189651799465538, 0.19988761407514449, 0.19789869908361465, 0.19592957412690934, 0.19398004229089189, 0.19204990862075408, 0.1901389801015205, 0.1882470656387468, 0.18637397603940997, 0.18451952399298926, 0.18268352405273466, 0.1808657926171221, 0.17906614791149322, 0.17728440996987782, 0.17552040061699686, 0.17377394345044514, 0.17204486382305054, 0.17033298882540943, 0.1686381472685955, 0.16696016966704069, 0.16529888822158653, 0.16365413680270405, 0.16202575093388075, 0.16041356777517274, 0.15881742610692068, 0.15723716631362761, 0.15567263036799731, 0.1541236618151314, 0.15259010575688386, 0.15107180883637084, 0.14956861922263504, 0.14808038659546244, 0.14660696213035015, 0.14514819848362373, 0.14370394977770293, 0.14227407158651359, 0.140858420921045, 0.13945685621505094, 0.13806923731089282, 0.13669542544552385],\n name='_line0',\n mode='lines',\n line=Line(\n dash='solid',\n color='#4C72B0',\n width=1.75,\n opacity=1\n )\n ),\n Scatter(\n x=[0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99],\n y=[0.0, 0.062790519529313374, 0.12533323356430426, 0.1873813145857246, 0.24868988716485479, 0.3090169943749474, 0.36812455268467792, 0.42577929156507272, 0.48175367410171532, 0.53582679497899666, 0.58778525229247314, 0.63742398974868963, 0.68454710592868862, 0.72896862742141155, 0.77051324277578925, 0.80901699437494734, 0.84432792550201508, 0.87630668004386369, 0.90482705246601958, 0.92977648588825135, 0.95105651629515353, 0.96858316112863108, 0.98228725072868861, 0.99211470131447788, 0.99802672842827156, 1.0, 0.99802672842827156, 0.99211470131447776, 0.98228725072868861, 0.96858316112863119, 0.95105651629515364, 0.92977648588825135, 0.90482705246601947, 0.87630668004386347, 0.84432792550201496, 0.80901699437494745, 0.77051324277578925, 0.72896862742141155, 0.68454710592868884, 0.63742398974868986, 0.58778525229247325, 0.53582679497899666, 0.4817536741017156, 0.42577929156507288, 0.36812455268467814, 0.30901699437494751, 0.24868988716485479, 0.18738131458572455, 0.12533323356430454, 0.062790519529313582, 1.2246467991473532e-16, -0.062790519529313332, -0.12533323356430431, -0.18738131458572477, -0.24868988716485502, -0.30901699437494773, -0.36812455268467836, -0.42577929156507272, -0.48175367410171499, -0.53582679497899643, -0.58778525229247303, -0.63742398974868963, -0.68454710592868873, -0.72896862742141133, -0.77051324277578936, -0.80901699437494734, -0.8443279255020153, -0.87630668004386358, -0.9048270524660198, -0.92977648588825146, -0.95105651629515353, -0.96858316112863097, -0.98228725072868872, -0.99211470131447776, -0.99802672842827156, -1.0, -0.99802672842827156, -0.99211470131447788, -0.98228725072868872, -0.96858316112863108, -0.95105651629515364, -0.92977648588825124, -0.90482705246601958, -0.87630668004386336, -0.84432792550201552, -0.80901699437494756, -0.77051324277578959, -0.72896862742141155, -0.68454710592868895, -0.63742398974868963, -0.58778525229247325, -0.53582679497899632, -0.48175367410171532, -0.42577929156507222, -0.36812455268467781, -0.30901699437494762, -0.24868988716485535, -0.18738131458572468, -0.12533323356430467, -0.062790519529313263, -2.4492935982947064e-16, 0.062790519529312763, 0.12533323356430418, 0.18738131458572421, 0.24868988716485491, 0.30901699437494717, 0.36812455268467825, 0.4257792915650726, 0.48175367410171571, 0.53582679497899666, 0.58778525229247369, 0.63742398974868997, 0.68454710592868928, 0.72896862742141177, 0.77051324277578925, 0.80901699437494778, 0.84432792550201474, 0.87630668004386314, 0.90482705246601935, 0.92977648588825113, 0.95105651629515342, 0.96858316112863097, 0.98228725072868861, 0.99211470131447776, 0.99802672842827156, 1.0, 0.99802672842827156, 0.99211470131447788, 0.98228725072868861, 0.96858316112863108, 0.95105651629515364, 0.92977648588825168, 0.90482705246601924, 0.87630668004386347, 0.84432792550201508, 0.80901699437494767, 0.77051324277578859, 0.728968627421411, 0.68454710592868839, 0.63742398974868963, 0.58778525229247336, 0.53582679497899721, 0.48175367410171616, 0.42577929156507394, 0.36812455268467797, 0.30901699437494778, 0.24868988716485549, 0.18738131458572568, 0.1253332335643039, 0.062790519529313374, 3.6739403974420594e-16, -0.062790519529312652, -0.12533323356430318, -0.18738131458572496, -0.24868988716485474, -0.30901699437494706, -0.36812455268467725, -0.42577929156507327, -0.4817536741017156, -0.53582679497899666, -0.5877852522924728, -0.63742398974869052, -0.68454710592868917, -0.72896862742141177, -0.77051324277578914, -0.80901699437494723, -0.84432792550201563, -0.87630668004386303, -0.90482705246601891, -0.92977648588825135, -0.95105651629515342, -0.96858316112863097, -0.9822872507286885, -0.99211470131447788, -0.99802672842827156, -1.0, -0.99802672842827156, -0.99211470131447799, -0.98228725072868861, -0.96858316112863119, -0.95105651629515375, -0.92977648588825168, -0.90482705246601924, -0.87630668004386347, -0.84432792550201519, -0.80901699437494767, -0.77051324277578859, -0.72896862742141111, -0.6845471059286885, -0.63742398974868975, -0.58778525229247347, -0.53582679497899577, -0.48175367410171627, -0.42577929156507405, -0.36812455268467809, -0.3090169943749479, -0.2486898871648556, -0.18738131458572582, -0.12533323356430404, -0.062790519529313499],\n name='_line1',\n mode='lines+markers',\n marker=Marker(\n symbol='dot',\n line=Line(\n color='#000000',\n width=0\n ),\n size=7,\n color='#007F00',\n opacity=1\n ),\n line=Line(\n dash='dash',\n color='#007F00',\n width=1.75,\n opacity=1\n )\n ),\n Scatter(\n x=[0.0, 0.10000000000000001, 0.20000000000000001, 0.30000000000000004, 0.40000000000000002, 0.5, 0.60000000000000009, 0.70000000000000007, 0.80000000000000004, 0.90000000000000002, 1.0, 1.1000000000000001, 1.2000000000000002, 1.3, 1.4000000000000001, 1.5, 1.6000000000000001, 1.7000000000000002, 1.8, 1.9000000000000001],\n y=[0.0, 0.095310179804324935, 0.18232155679395459, 0.26236426446749106, 0.33647223662121289, 0.40546510810816438, 0.47000362924573563, 0.53062825106217049, 0.58778666490211906, 0.64185388617239469, 0.69314718055994529, 0.74193734472937733, 0.78845736036427028, 0.83290912293510388, 0.87546873735390007, 0.91629073187415511, 0.95551144502743635, 0.99325177301028345, 1.0296194171811581, 1.0647107369924285],\n name='_line2',\n mode='markers',\n marker=Marker(\n symbol='dot',\n line=Line(\n color='#55A868',\n width=0\n ),\n size=7,\n color='#55A868',\n opacity=1\n )\n ),\n Scatter(\n x=[0.0, 0.01, 0.02, 0.029999999999999999, 0.040000000000000001, 0.050000000000000003, 0.059999999999999998, 0.070000000000000007, 0.080000000000000002, 0.089999999999999997, 0.10000000000000001, 0.11, 0.12, 0.13, 0.14000000000000001, 0.14999999999999999, 0.16, 0.17000000000000001, 0.17999999999999999, 0.19, 0.20000000000000001, 0.20999999999999999, 0.22, 0.23000000000000001, 0.23999999999999999, 0.25, 0.26000000000000001, 0.27000000000000002, 0.28000000000000003, 0.28999999999999998, 0.29999999999999999, 0.31, 0.32000000000000001, 0.33000000000000002, 0.34000000000000002, 0.35000000000000003, 0.35999999999999999, 0.37, 0.38, 0.39000000000000001, 0.40000000000000002, 0.41000000000000003, 0.41999999999999998, 0.42999999999999999, 0.44, 0.45000000000000001, 0.46000000000000002, 0.47000000000000003, 0.47999999999999998, 0.48999999999999999, 0.5, 0.51000000000000001, 0.52000000000000002, 0.53000000000000003, 0.54000000000000004, 0.55000000000000004, 0.56000000000000005, 0.57000000000000006, 0.57999999999999996, 0.58999999999999997, 0.59999999999999998, 0.60999999999999999, 0.62, 0.63, 0.64000000000000001, 0.65000000000000002, 0.66000000000000003, 0.67000000000000004, 0.68000000000000005, 0.69000000000000006, 0.70000000000000007, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.83999999999999997, 0.84999999999999998, 0.85999999999999999, 0.87, 0.88, 0.89000000000000001, 0.90000000000000002, 0.91000000000000003, 0.92000000000000004, 0.93000000000000005, 0.94000000000000006, 0.95000000000000007, 0.95999999999999996, 0.96999999999999997, 0.97999999999999998, 0.98999999999999999, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.0600000000000001, 1.0700000000000001, 1.0800000000000001, 1.0900000000000001, 1.1000000000000001, 1.1100000000000001, 1.1200000000000001, 1.1300000000000001, 1.1400000000000001, 1.1500000000000001, 1.1599999999999999, 1.1699999999999999, 1.1799999999999999, 1.1899999999999999, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.3100000000000001, 1.3200000000000001, 1.3300000000000001, 1.3400000000000001, 1.3500000000000001, 1.3600000000000001, 1.3700000000000001, 1.3800000000000001, 1.3900000000000001, 1.4000000000000001, 1.4099999999999999, 1.4199999999999999, 1.4299999999999999, 1.4399999999999999, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.5600000000000001, 1.5700000000000001, 1.5800000000000001, 1.5900000000000001, 1.6000000000000001, 1.6100000000000001, 1.6200000000000001, 1.6300000000000001, 1.6400000000000001, 1.6500000000000001, 1.6600000000000001, 1.6699999999999999, 1.6799999999999999, 1.6899999999999999, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.8100000000000001, 1.8200000000000001, 1.8300000000000001, 1.8400000000000001, 1.8500000000000001, 1.8600000000000001, 1.8700000000000001, 1.8800000000000001, 1.8900000000000001, 1.9000000000000001, 1.9100000000000001, 1.9199999999999999, 1.9299999999999999, 1.9399999999999999, 1.95, 1.96, 1.97, 1.98, 1.99],\n y=[0.0, 0.062165743421020596, 0.12285146926097672, 0.18184335981016436, 0.23893861721197537, 0.29394605772022159, 0.34668664765999591, 0.39699398009920667, 0.4447146914951135, 0.48970881783523779, 0.53185009004393646, 0.57102616867378042, 0.60713881814373882, 0.64010402102317443, 0.66985203309097185, 0.69632738012194328, 0.71948879756726813, 0.73930911450139214, 0.75577508340393029, 0.76888715753105119, 0.77865921780605296, 0.78511825132287161, 0.78830398370865495, 0.78826846773191139, 0.78507563067078134, 0.77880078307140488, 0.76953009162896391, 0.75736001901360417, 0.74239673353998659, 0.72475549164263386, 0.70455999616952891, 0.68194173354365373, 0.65703929286642604, 0.62999767004847074, 0.60096756005205387, 0.5701046403160569, 0.53756884840888908, 0.50352365691755985, 0.46813534853263294, 0.43157229422939808, 0.39400423737576057, 0.35560158651755347, 0.31653471950275153, 0.27697330150793059, 0.23708561942387243, 0.19703793494301369, 0.15699385857013562, 0.11711374664987216, 0.077554123370951619, 0.038467129568209538, 7.42785831001809e-17, -0.037705429368677892, -0.074513182697526562, -0.11029357299002086, -0.14492359712840394, -0.178287296308974, -0.21027608111877885, -0.24078902065151586, -0.26973309521643124, -0.2970234123487005, -0.32258338598257219, -0.34634487879888559, -0.36824830790587049, -0.38824271415589529, -0.40628579554051591, -0.42234390524133192, -0.43639201504432457, -0.44841364495009212, -0.45840075993135643, -0.46635363490187992, -0.47228068906722837, -0.47619829092729044, -0.47813053529290755, -0.47810899376410282, -0.47617244019506066, -0.47236655274101469, -0.46674359414443878, -0.45936207197229401, -0.45028638056251219, -0.43958642647636065, -0.42733723928383482, -0.41361856953180914, -0.39851447575939558, -0.38211290243192081, -0.36450525066426415, -0.34578594359613163, -0.32605198826640425, -0.30540253581112531, -0.28393844178030153, -0.26176182833265149, -0.23897565002509305, -0.21568326486535064, -0.19198801224195713, -0.16799279928639099, -0.14379969715753954, -0.11950954866940107, -0.095221588609376448, -0.071033078016965234, -0.047038953611618299, -0.023331493474257361, -9.0104476020544775e-17, 0.022869498949732101, 0.045194529858818715, 0.066896433587700643, 0.087900604974218713, 0.10813671144866356, 0.1275388902027601, 0.14604592354732276, 0.16360139218795283, 0.18015380624195493, 0.19565671391234482, 0.21006878782598024, 0.22335388913220877, 0.23548110954559864, 0.24642479160106115, 0.2561645274716351, 0.26468513677815952, 0.27197662389572586, 0.27803411533393801, 0.2828577778364218, 0.28645271790948318, 0.28882886355015802, 0.29000082899996177, 0.28998776340228466, 0.28881318428848463, 0.28650479686019009, 0.28309430007307207, 0.2786171805603177, 0.27311249546219446, 0.26662264525142604, 0.25919313766259983, 0.25087234384752405, 0.24171124788738035, 0.23176319079674212, 0.22108361015411482, 0.20972977648871718, 0.19776052754383772, 0.18523600152343281, 0.17221737041078325, 0.15876657442618819, 0.14494605866497509, 0.13081851292775601, 0.1164466157220316, 0.10189278337814718, 0.087218925183439405, 0.072486205396410944, 0.057754812958130106, 0.043083739671049108, 0.028530567566246629, 0.014151266129022342, 8.1976690925703258e-17, -0.013871052285278363, -0.027411868010671404, -0.040574737996370604, -0.053314411924152427, -0.065588230934112562, -0.077356247213697008, -0.088581330357498655, -0.099229260333664276, -0.10926880694967485, -0.11867179576646029, -0.1274131604651251, -0.13547098172474095, -0.14282651272255487, -0.14946419141933984, -0.15537163984234573, -0.16053965062618583, -0.16496216111788936, -0.16863621539611176, -0.17156191459597445, -0.1737423559701157, -0.17518356115312753, -0.17589439413055735, -0.17588646944497877, -0.17517405120020096, -0.17377394345044514, -0.17170537258420662, -0.16898986233252339, -0.16565110204844838, -0.16171480891867487, -0.1572085847794841, -0.15216176821749336, -0.14660528264109668, -0.14057148101105291, -0.13409398791842592, -0.12720753969508478, -0.11994782323628231, -0.11235131420653809, -0.10445511528922737, -0.096296795127030863, -0.087914228584813431, -0.079345438948697292, -0.070628442655187362, -0.061801097122304069, -0.052900952230938332, -0.043965105979150605, -0.035030064805074417, -0.026131609045568792, -0.017304663967931452, -0.0085831767810049826],\n name='_line3',\n mode='lines+markers',\n marker=Marker(\n symbol='square',\n line=Line(\n color='#000000',\n width=0\n ),\n size=7,\n color='#FF0000',\n opacity=1\n ),\n line=Line(\n dash='dashdot',\n color='#FF0000',\n width=1.75,\n opacity=1\n )\n )\n ]),\n layout=Layout(\n title='Damped oscillation',\n xaxis=XAxis(\n title='time',\n domain=[0.0, 1.0],\n range=(0.0, 2.0),\n showline=True,\n ticks='inside',\n showgrid=True,\n zeroline=False,\n titlefont=Font(\n size=11.0,\n color='#000000'\n ),\n anchor='y',\n mirror=True\n ),\n yaxis=YAxis(\n title='volts',\n domain=[0.0, 1.0],\n range=(-1.0, 1.5),\n showline=True,\n ticks='inside',\n showgrid=True,\n zeroline=False,\n titlefont=Font(\n size=11.0,\n color='#000000'\n ),\n anchor='x',\n mirror=True\n ),\n width=480,\n height=320,\n autosize=False,\n margin=Margin(\n l=60,\n r=47,\n b=40,\n t=31,\n pad=0\n ),\n hovermode='closest',\n titlefont=Font(\n size=12.0,\n color='#262626'\n ),\n showlegend=False,\n annotations=Annotations([\n \n ])\n )\n)\n"
}
],
"prompt_number": 21
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You can also strip out the matplotlib styling, and use Plotly's default styling."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig = tls.mpl_to_plotly(fig3)\nfig['layout'].update(showlegend=True)\nfig.strip_style()\npy.iplot(fig)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3315\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e5f1210>"
}
],
"prompt_number": 22
},
{
"cell_type": "markdown",
"metadata": {},
"source": "First up, an example from [pylab](http://matplotlib.org/examples/pylab_examples/arctest.html)."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig4 = plt.figure()\n\nfrom pylab import *\n\ndef f(t):\n 'a damped exponential'\n s1 = cos(2*pi*t)\n e1 = exp(-t)\n return multiply(s1,e1)\n\nt1 = arange(0.0, 5.0, .2)\n\n\nl = plot(t1, f(t1), 'ro')\nsetp(l, 'markersize', 30)\nsetp(l, 'markerfacecolor', 'b')\n\npy.iplot_mpl(fig4)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3316\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e6ba410>"
}
],
"prompt_number": 23
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You can also plot with Plotly with pandas, NumPy, datetime, and more of your favorite Python tools. We've already imported numpy and matplotlib; here we've kept them in so you can simply copy and paste these examples into your own NB. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig5 = plt.figure()\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# make a little extra space between the subplots\nplt.subplots_adjust(wspace=0.5)\n\ndt = 0.01\nt = np.arange(0, 30, dt)\nnse1 = np.random.randn(len(t)) # white noise 1\nnse2 = np.random.randn(len(t)) # white noise 2\nr = np.exp(-t/0.05)\n\ncnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1\ncnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2\n\n# two signals with a coherent part and a random part\ns1 = 0.01*np.sin(2*np.pi*10*t) + cnse1\ns2 = 0.01*np.sin(2*np.pi*10*t) + cnse2\n\nplt.subplot(211)\nplt.plot(t, s1, 'b-', t, s2, 'g-')\nplt.xlim(0,5)\nplt.xlabel('time')\nplt.ylabel('s1 and s2')\nplt.grid(True)\n\nplt.subplot(212)\ncxy, f = plt.csd(s1, s2, 256, 1./dt)\nplt.ylabel('CSD (db)')\n\npy.iplot_mpl(fig5)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3317\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e5ef510>"
}
],
"prompt_number": 24
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Another subplotting example, in this case we're using Plotly's defaults. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig6 = plt.figure()\n\nfrom pylab import figure, show\nfrom numpy import arange, sin, pi\n\nt = arange(0.0, 1.0, 0.01)\n\nfig = figure(1)\n\nax1 = fig.add_subplot(211)\nax1.plot(t, sin(2*pi*t))\nax1.grid(True)\nax1.set_ylim( (-2,2) )\nax1.set_ylabel('1 Hz')\nax1.set_title('A sine wave or two')\n\nfor label in ax1.get_xticklabels():\n label.set_color('r')\n\n\nax2 = fig.add_subplot(212)\nax2.plot(t, sin(2*2*pi*t))\nax2.grid(True)\nax2.set_ylim( (-2,2) )\nl = ax2.set_xlabel('Hi mom')\nl.set_color('g')\nl.set_fontsize('large')\n\npy.iplot_mpl(fig6, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3318\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10e5f1550>"
}
],
"prompt_number": 25
},
{
"cell_type": "markdown",
"metadata": {},
"source": "From the gallery here we're shwoing [Anscombe's quartet](http://matplotlib.org/examples/pylab_examples/anscombe.html). You might also like Plotly's [blog post](blog.plot.ly/post/68951620673/why-graph-anscombes-quartet) on the subject."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig7 = plt.figure()\n\nfrom __future__ import print_function\n\"\"\"\nEdward Tufte uses this example from Anscombe to show 4 datasets of x\nand y that have the same mean, standard deviation, and regression\nline, but which are qualitatively different.\n\nmatplotlib fun for a rainy day\n\"\"\"\n\nfrom pylab import *\n\nx = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])\ny1 = array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68])\ny2 = array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74])\ny3 = array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73])\nx4 = array([8,8,8,8,8,8,8,19,8,8,8])\ny4 = array([6.58,5.76,7.71,8.84,8.47,7.04,5.25,12.50,5.56,7.91,6.89])\n\ndef fit(x):\n return 3+0.5*x\n\n\n\nxfit = array( [amin(x), amax(x) ] )\n\nsubplot(221)\nplot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2)\naxis([2,20,2,14])\nsetp(gca(), xticklabels=[], yticks=(4,8,12), xticks=(0,10,20))\ntext(3,12, 'I', fontsize=20)\n\nsubplot(222)\nplot(x,y2,'ks', xfit, fit(xfit), 'r-', lw=2)\naxis([2,20,2,14])\nsetp(gca(), xticklabels=[], yticks=(4,8,12), yticklabels=[], xticks=(0,10,20))\ntext(3,12, 'II', fontsize=20)\n\nsubplot(223)\nplot(x,y3,'ks', xfit, fit(xfit), 'r-', lw=2)\naxis([2,20,2,14])\ntext(3,12, 'III', fontsize=20)\nsetp(gca(), yticks=(4,8,12), xticks=(0,10,20))\n\nsubplot(224)\n\nxfit = array([amin(x4),amax(x4)])\nplot(x4,y4,'ks', xfit, fit(xfit), 'r-', lw=2)\naxis([2,20,2,14])\nsetp(gca(), yticklabels=[], yticks=(4,8,12), xticks=(0,10,20))\ntext(3,12, 'IV', fontsize=20)\n\n#verify the stats\npairs = (x,y1), (x,y2), (x,y3), (x4,y4)\nfor x,y in pairs:\n print ('mean=%1.2f, std=%1.2f, r=%1.2f'%(mean(y), std(y), corrcoef(x,y)[0][1]))\n\npy.iplot_mpl(fig7, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "mean=7.50, std=1.94, r=0.82\nmean=7.50, std=1.94, r=0.82\nmean=7.50, std=1.94, r=0.82\nmean=7.50, std=1.94, r=0.82\n"
},
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3319\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10f7301d0>"
}
],
"prompt_number": 26
},
{
"cell_type": "markdown",
"metadata": {},
"source": "[histogram](http://matplotlib.org/examples/statistics/histogram_demo_features.html)"
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig8 = plt.figure()\n\nimport numpy as np\nimport matplotlib.mlab as mlab\nimport matplotlib.pyplot as plt\n\n\n# example data\nmu = 100 # mean of distribution\nsigma = 15 # standard deviation of distribution\nx = mu + sigma * np.random.randn(10000)\n\nnum_bins = 50\n# the histogram of the data\nn, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0.5)\n# add a 'best fit' line\ny = mlab.normpdf(bins, mu, sigma)\nplt.plot(bins, y, 'r--')\nplt.xlabel('Smarts')\nplt.ylabel('Probability')\nplt.title(r'Histogram of IQ: $\\mu=100$, $\\sigma=15$')\n\n# Tweak spacing to prevent clipping of ylabel\nplt.subplots_adjust(left=0.15)\n\npy.iplot_mpl(fig8, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3320\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10fe0f350>"
}
],
"prompt_number": 27
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "III. Stack Overflow Answers"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "We love Stack Overflow, so wanted to show answers to a few questions from there, in Plotly. If you want to plot data you already have as a [histogram](http://stackoverflow.com/questions/5328556/histogram-matplotlib) and make it interactive, try this one out."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig9 = plt.figure()\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nmu, sigma = 100, 15\nx = mu + sigma * np.random.randn(10000)\nhist, bins = np.histogram(x, bins=50)\nwidth = 0.7 * (bins[1] - bins[0])\ncenter = (bins[:-1] + bins[1:]) / 2\nplt.bar(center, hist, align='center', width=width)\n\npy.iplot_mpl(fig9, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3321\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x1100d3a10>"
}
],
"prompt_number": 28
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Here is how to create a [density plot](http://stackoverflow.com/questions/4150171/how-to-create-a-density-plot-in-matplotlib/4152016#4152016) like you might in R, but in matplotlib."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig10 = plt.figure()\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.stats import gaussian_kde\ndata = [1.5]*7 + [2.5]*2 + [3.5]*8 + [4.5]*3 + [5.5]*1 + [6.5]*8\ndensity = gaussian_kde(data)\nxs = np.linspace(0,8,200)\ndensity.covariance_factor = lambda : .25\ndensity._compute_covariance()\nplt.plot(xs,density(xs))\n\npy.iplot_mpl(fig10, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3322\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x10fe131d0>"
}
],
"prompt_number": 29
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Drawing a simple example of [different lines for different plots](http://stackoverflow.com/questions/4805048/how-to-get-different-lines-for-different-plots-in-a-single-figure/4805456#4805456) looks like this..."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig11 = plt.figure()\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nx = np.arange(10)\n\nplt.plot(x, x)\nplt.plot(x, 2 * x)\nplt.plot(x, 3 * x)\nplt.plot(x, 4 * x)\n\npy.iplot_mpl(fig11, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3323\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x110297550>"
}
],
"prompt_number": 30
},
{
"cell_type": "markdown",
"metadata": {},
"source": "...and can get more exciting like this."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig12 = plt.figure()\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nnum_plots = 10\n\n# Have a look at the colormaps here and decide which one you'd like:\n# http://matplotlib.org/1.2.1/examples/pylab_examples/show_colormaps.html\ncolormap = plt.cm.gist_ncar\nplt.gca().set_color_cycle([colormap(i) for i in np.linspace(0, 0.9, num_plots)])\n\n# Plot several different functions...\nx = np.arange(10)\nlabels = []\nfor i in range(1, num_plots + 1):\n plt.plot(x, i * x + 5 * i)\n labels.append(r'$y = %ix + %i$' % (i, 5*i))\n\npy.iplot_mpl(fig12, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3324\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x1102d43d0>"
}
],
"prompt_number": 31
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Plotly also shows LaTeX if you want to draw [variables as subscripts in math mode](http://stackoverflow.com/questions/23276918/writing-variables-as-subscripts-in-math-mode)."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig13 = plt.figure()\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib.mlab as mlab\n\nmean = [10,12,16,22,25]\nvariance = [3,6,8,10,12]\n\nx = np.linspace(0,40,1000)\n\nfor i in range(4):\n sigma = np.sqrt(variance[i])\n y = mlab.normpdf(x,mean[i],sigma)\n plt.plot(x,y, label=r'$v_{}$'.format(i+1))\n\nplt.xlabel(\"X\")\nplt.ylabel(\"P(X)\") \n\npy.iplot_mpl(fig13, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3325\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x1107c0810>"
}
],
"prompt_number": 32
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "IV. Prettyplotlib graphs in Plotly"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "The gallery of [examples](http://nbviewer.ipython.org/github/olgabot/prettyplotlib/blob/master/ipython_notebooks/Examples%20of%20everything%20pretty%20and%20plotted!.ipynb?create=1) we really like from [prettyplotlib](https://github.com/olgabot/prettyplotlib) can be a fun one to make interactive. Here's a scatter; let us know if you make others. You'll note that not all elements of the styling come through. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig14 = plt.figure()\n\nimport prettyplotlib as ppl\n\n# Set the random seed for consistency\nnp.random.seed(12)\n\n# Show the whole color range\nfor i in range(8):\n x = np.random.normal(loc=i, size=1000)\n y = np.random.normal(loc=i, size=1000)\n ax = ppl.scatter(x, y, label=str(i))\n \nppl.legend(ax)\nax.set_title('prettyplotlib `scatter`')\nax.legend().set_visible(False)\n\npy.iplot_mpl(fig14)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3343\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x110f93cd0>"
}
],
"prompt_number": 51
},
{
"cell_type": "markdown",
"metadata": {},
"source": "prettyplotlib again improves on matplotlib's defaults, adding an appealing set of defaults. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig15 = plt.figure()\n\nimport prettyplotlib as ppl\n\n# Set the random seed for consistency\nnp.random.seed(12)\n\n# Show the whole color range\nfor i in range(8):\n y = np.random.normal(size=1000).cumsum()\n x = np.arange(1000)\n\n # For now, you need to specify both x and y :(\n # Still figuring out how to specify just one\n ppl.plot(x, y, label=str(i), linewidth=0.75)\n \npy.iplot_mpl(fig15)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3346\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x110fc72d0>"
}
],
"prompt_number": 56
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "V. Plotting with seaborn"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Another library we really difg is [seaborn](http://stanford.edu/~mwaskom/software/seaborn/index.html), an awesome project by Michael Waskom. You may need to [import six](http://stackoverflow.com/questions/13967428/importerror-no-module-named-six), which you can do from pip. The styling isn't yet translated to Plotly, so we'll go to Plotly's default settings. "
},
{
"cell_type": "code",
"collapsed": false,
"input": "import seaborn as sns\nfrom matplotlylib import fig_to_plotly",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": "def sinplot(flip=1):\n x = np.linspace(0, 14, 100)\n for i in range(1, 7):\n plt.plot(x, np.sin(x + i * .5) * (7 - i) * flip)",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 45
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig16 = plt.figure()\n\nsns.set_style(\"dark\")\nsinplot()\n\npy.iplot_mpl(fig16, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3339\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x110fab290>"
}
],
"prompt_number": 46
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You can also run subplots like this."
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig17 = plt.figure()\n\nwith sns.axes_style(\"darkgrid\"):\n plt.subplot(211)\n sinplot()\nplt.subplot(212)\nsinplot(-1)\n\npy.iplot_mpl(fig17, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3340\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x111ab4150>"
}
],
"prompt_number": 47
},
{
"cell_type": "markdown",
"metadata": {},
"source": "And a final example, [combining plot types](http://stanford.edu/~mwaskom/software/seaborn/tutorial/plotting_distributions.html#basic-visualization-with-histograms)."
},
{
"cell_type": "code",
"collapsed": false,
"input": "import numpy as np\nfrom numpy.random import randn\nimport pandas as pd\nfrom scipy import stats\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport seaborn as sns",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 42
},
{
"cell_type": "code",
"collapsed": false,
"input": "fig18 = plt.figure()\n\nsns.set_palette(\"hls\")\nmpl.rc(\"figure\", figsize=(8, 4))\ndata = randn(200)\nsns.distplot(data);\n\npy.iplot_mpl(fig18, strip_style = True)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~IPython.Demo/3341\" height=\"525\" width=\"100%\"></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x110d1f550>"
}
],
"prompt_number": 48
},
{
"cell_type": "code",
"collapsed": false,
"input": "",
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
@cqcn1991
Copy link

cqcn1991 commented Jun 6, 2016

What about adding a sidebar it? So it would be easier to navigate through the notebook.
Mine is like this:
https://nbviewer.jupyter.org/github/cqcn1991/Wind-Speed-Analysis/blob/master/GMM.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment