{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Srijith Rajamohan, Phd, Virginia Tech" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Plot.ly is an rich visualization tool. It can be viewed online as well as offline that has support for a variety of plots." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Administrative Note\n", "\n", "\n", "## For VMs - This Notebook runs in a docker container and the files are mapped to /host/ on your VM\n", "\n", "## Docker container - If you are running the Docker container on your machine it is the host folder you have mapped into your container\n", "\n", "## Running Natively - If you are running this natively on your laptop, the files should be in the folder from where you are spawning Jupyter Notebooks" ] }, { "cell_type": "code", "execution_count": 370, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2.0.9'" ] }, "execution_count": 370, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import plotly\n", "plotly.__version__\n", "# conda install -c conda-forge plotly=2.0.2" ] }, { "cell_type": "code", "execution_count": 371, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import plotly.tools as tls\n", "# Please replace this with your credentials\n", "tls.set_credentials_file(username='sjster@gmail.com', api_key='0wyOKkwBuNZOwCEEVkEM')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## When plotting online, the plot and data will be saved to your cloud account. There are two methods for plotting online: plotly.plotly.plot() and plotly.plotly.iplot(). Both options create a unique url for the plot and save it in your Plotly account.\n", "\n", "

Use plotly.plotly.plot() to return the unique url and optionally open the url.\n", "

Use plotly.plotly.iplot() when working in a Jupyter Notebook to display the plot in the notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Let us look at a simple example of a Scatterplot" ] }, { "cell_type": "code", "execution_count": 372, "metadata": { "slideshow": { "slide_type": "slide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'data': [{'connectgaps': True,\n", " 'name': 'No Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [10,\n", " 20,\n", " None,\n", " 15,\n", " 10,\n", " 5,\n", " 15,\n", " None,\n", " 20,\n", " 10,\n", " 10,\n", " 15,\n", " 25,\n", " 20,\n", " 10]},\n", " {'name': 'Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [5, 15, None, 10, 5, 0, 10, None, 15, 5, 5, 10, 20, 15, 5]}]}\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 372, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "import pprint\n", "\n", "\n", "trace1 = go.Scatter(\n", " x=[1, 2, 3, 4, 5, \n", " 6, 7, 8, 9, 10,\n", " 11, 12, 13, 14, 15],\n", " y=[10, 20, None, 15, 10,\n", " 5, 15, None, 20, 10,\n", " 10, 15, 25, 20, 10],\n", " name = 'No Gaps', # Style name/legend entry with html tags\n", " connectgaps=True\n", ")\n", "trace2 = go.Scatter(\n", " x=[1, 2, 3, 4, 5,\n", " 6, 7, 8, 9, 10,\n", " 11, 12, 13, 14, 15],\n", " y=[5, 15, None, 10, 5,\n", " 0, 10, None, 15, 5,\n", " 5, 10, 20, 15, 5],\n", " name = 'Gaps',\n", ")\n", "\n", "data = [trace1, trace2]\n", "\n", "fig = dict(data=data)\n", "pprint.pprint(fig)\n", "py.iplot(fig, filename='simple-connectgaps')" ] }, { "cell_type": "code", "execution_count": 373, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'data': [{'connectgaps': True,\n", " 'name': 'No Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [10,\n", " 20,\n", " None,\n", " 15,\n", " 10,\n", " 5,\n", " 15,\n", " None,\n", " 20,\n", " 10,\n", " 10,\n", " 15,\n", " 25,\n", " 20,\n", " 10]},\n", " {'name': 'Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [5, 15, None, 10, 5, 0, 10, None, 15, 5, 5, 10, 20, 15, 5]}],\n", " 'layout': {'title': 'Plot Title',\n", " 'xaxis': {'title': 'x Axis'},\n", " 'yaxis': {'title': 'y Axis'}}}\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 373, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "import pprint\n", "\n", "# Create the data\n", "trace1 = go.Scatter(\n", " x=[1, 2, 3, 4, 5, \n", " 6, 7, 8, 9, 10,\n", " 11, 12, 13, 14, 15],\n", " y=[10, 20, None, 15, 10,\n", " 5, 15, None, 20, 10,\n", " 10, 15, 25, 20, 10],\n", " name = 'No Gaps', # Style name/legend entry with html tags\n", " connectgaps=True\n", ")\n", "trace2 = go.Scatter(\n", " x=[1, 2, 3, 4, 5,\n", " 6, 7, 8, 9, 10,\n", " 11, 12, 13, 14, 15],\n", " y=[5, 15, None, 10, 5,\n", " 0, 10, None, 15, 5,\n", " 5, 10, 20, 15, 5],\n", " name = 'Gaps',\n", ")\n", "\n", "data = [trace1, trace2]\n", "\n", "# Add axis labels and title\n", "layout = go.Layout(\n", " title='Plot Title',\n", " xaxis=dict(\n", " title='x Axis',\n", " ),\n", " yaxis=dict(\n", " title='y Axis',\n", " )\n", ")\n", "\n", "fig = dict(data=data,layout=layout)\n", "pprint.pprint(fig)\n", "py.iplot(fig, filename='simple-connectgaps')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Explicitly create the plot object" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "\n", "fig = {'data': [{'connectgaps': True,\n", " 'name': 'No Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [10,\n", " 20,\n", " None,\n", " 15,\n", " 10,\n", " 5,\n", " 15,\n", " None,\n", " 20,\n", " 10,\n", " 10,\n", " 15,\n", " 25,\n", " 20,\n", " 10]},\n", " {'name': 'Gaps',\n", " 'type': 'scatter',\n", " 'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\n", " 'y': [5, 15, None, 10, 5, 0, 10, None, 15, 5, 5, 10, 20, 15, 5]}],\n", " 'layout': {'title': 'Plot Title',\n", " 'xaxis': {'title': 'x Axis'},\n", " 'yaxis': {'title': 'y Axis'}}}\n", "\n", "\n", "py.iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create Subplots" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "5329f851-3677-44ef-aac2-63f8d1d913d4" } }, "outputs": [], "source": [ "\n", "from plotly import tools # Used to create subplots\n", "\n", "trace1 = go.Scatter(\n", " x=[1, 2, 3],\n", " y=[4, 5, 6],\n", " name = \"Line 1\"\n", "# Color and width to lines \n", "# line = dict(\n", "# color = 'blue',\n", "# width = 4,\n", "# dash = 'dash',\n", "#)\n", ")\n", "\n", "trace2 = go.Scatter(\n", " x=[20, 30, 40],\n", " y=[50, 60, 70],\n", " name = \"Line 2\"\n", ")\n", "\n", "# Add a third plot to the second subplot\n", "#trace3 = go.Scatter(\n", "# x=[20, 30, 40],\n", "# y=[10, 15, 45]\n", "#)\n", "\n", "fig = tools.make_subplots(rows=1, cols=2, subplot_titles=('Plot 1', 'Plot 2'))\n", "\n", "# Fig object has been created, and you can add/modify it\n", "fig.append_trace(trace1, 1, 1)\n", "fig.append_trace(trace2, 1, 2)\n", "#fig.append_trace(trace3, 1, 2)\n", "\n", "# Modify the axis names\n", "fig['layout']['xaxis1'].update(title='xaxis 1 title')\n", "fig['layout']['yaxis1'].update(title='yaxis 1 title')\n", "fig['layout']['xaxis2'].update(title='xaxis 2 title')\n", "fig['layout']['yaxis2'].update(title='yaxis 2 title')\n", "\n", "#Modify the dimensions of the plots\n", "fig['layout'].update(height=600, width=600, title='Hello subplots')\n", "py.iplot(fig, filename='make-subplots')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Let us look at the list of the graph objects available to you" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dir(go)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plotly Offline allows you to create graphs offline and save them locally. There are also two methods for plotting offline: plotly.offline.plot() and plotly.offline.iplot().\n", "\n", "

Use plotly.offline.plot() to create and standalone HTML that is saved locally and opened inside your web browser.\n", "

Use plotly.offline.iplot() when working offline in a Jupyter Notebook to display the plot in the notebook.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "79b29f7e-f5e0-4f01-8726-a385d879c5e0" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from plotly.offline import download_plotlyjs, init_notebook_mode\n", "import plotly.offline as offline\n", "from plotly.graph_objs import Scatter, Figure, Layout, Histogram2dContour\n", "\n", "#Create plot in a separate file and open in browser\n", "offline.plot([Scatter(x=[1, 2, 3], y=[3, 1, 6])])\n", "offline.plot([Scatter(x=[1, 2, 3], y=[3, 1, 6])],filename=\"Hello.html\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Let us create an offline plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "a78a37a9-469c-4c19-a7c4-266e2002c3aa" }, "slideshow": { "slide_type": "slide" } }, "outputs": [], "source": [ "import plotly\n", "import plotly.offline as offline\n", "import plotly.graph_objs as go\n", "\n", "offline.init_notebook_mode(connected=True) #Use this option if you want smaller files and want plotly.js to be\n", "#loaded from the internet\n", "\n", "offline.iplot({'data': [{'y': [4, 2, 3, 4]}],\n", " 'layout': {'title': 'Test Plot',\n", " 'font': dict(size=16)}},\n", " image='png')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create the plot but load plotly.js from local repositories" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "0c03b3fd-e2e2-46ab-979f-db89039e8c39" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "# Initialise notebook viewing of plots\n", "offline.init_notebook_mode(connected=False) #Use this option if you want plotly.js to loaded from local repositories\n", "offline.iplot([Scatter(x=[1, 2, 3], y=[3, 1, 6])])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a Pie chart" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Simple Pie chart\n", "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "\n", "fig = {\n", " 'data': [{'labels': ['Residential', 'Non-Residential', 'Utility'],\n", " 'values': [19, 26, 55],\n", " 'type': 'pie'}],\n", " 'layout': {'title': 'Forcasted 2014 U.S. PV Installations by Market Segment'}\n", " }\n", "\n", "offline.iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Something slightly more complicated" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "13d4a2ed-1ed7-4ed7-83b9-bb8e97927ee2" }, "slideshow": { "slide_type": "slide" } }, "outputs": [], "source": [ "\n", "import numpy as np\n", "from plotly.graph_objs import Histogram2dContour, Contours, Marker\n", "import plotly.figure_factory as FF\n", "\n", "xval = np.random.randn(200)\n", "yval = np.random.randn(200)\n", "offline.iplot(\n", " [\n", " Histogram2dContour(x=xval, y=yval, contours=Contours(coloring='lines')), # options are fill,heatmap,lines,none\n", " Scatter(x=xval, y=yval, mode='markers', marker=Marker(color='black', size=4, opacity=0.3))\n", " ])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Basic bar chart" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "a77f8299-c1de-44f7-9ed0-af08f6002a3a" } }, "outputs": [], "source": [ "\n", "data = [go.Bar(\n", " x=['giraffes', 'orangutans', 'monkeys'],\n", " y=[20, 14, 23]\n", "# orientation = 'h'\n", " )]\n", "\n", "offline.iplot(data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Stacked bar charts" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "f770b49c-64cb-41ff-b699-8fdd8c9996e2" } }, "outputs": [], "source": [ "\n", "trace1 = go.Bar(\n", " x=['giraffes', 'orangutans', 'monkeys'],\n", " y=[20, 14, 23],\n", " name='SF Zoo'\n", ")\n", "trace2 = go.Bar(\n", " x=['giraffes', 'orangutans', 'monkeys'],\n", " y=[12, 18, 29],\n", " name='LA Zoo'\n", ")\n", "\n", "data = [trace1, trace2]\n", "layout = go.Layout(\n", " barmode='stack'\n", ")\n", "\n", "fig = go.Figure(data=data, layout=layout)\n", "offline.iplot(fig, filename='stacked-bar')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Text annotations for bar charts" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "cd810103-4609-4d09-a86c-6a1e23d9a11a" } }, "outputs": [], "source": [ "\n", "trace0 = go.Bar(\n", " x=['Product A', 'Product B', 'Product C'],\n", " y=[20, 14, 23],\n", " text=['27% market share', '24% market share', '19% market share'],\n", " opacity=0.5\n", ")\n", "\n", "data = [trace0]\n", "layout = go.Layout(\n", " title='January 2013 Sales Report',\n", ")\n", "\n", "fig = go.Figure(data=data, layout=layout)\n", "offline.iplot(fig, filename='text-hover-bar')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Grouped charts with angled text labels" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "83019633-23a4-4355-89ea-9299bc22a391" } }, "outputs": [], "source": [ "\n", "trace0 = go.Bar(\n", " x=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\n", " 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n", " y=[20, 14, 25, 16, 18, 22, 19, 15, 12, 16, 14, 17],\n", " name='Primary Product',\n", " marker=dict(\n", " color='rgb(49,130,189)'\n", " )\n", ")\n", "trace1 = go.Bar(\n", " x=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\n", " 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n", " y=[19, 14, 22, 14, 16, 19, 15, 14, 10, 12, 12, 16],\n", " name='Secondary Product',\n", " marker=dict(\n", " color='rgb(204,204,204)',\n", " )\n", ")\n", "\n", "data = [trace0, trace1]\n", "layout = go.Layout(\n", " xaxis=dict(tickangle=-45),\n", " barmode='group',\n", ")\n", "\n", "fig = go.Figure(data=data, layout=layout)\n", "offline.iplot(fig, filename='angled-text-bar')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "fb994501-a54e-4dff-8ead-20846c9e989d" }, "scrolled": false }, "outputs": [], "source": [ "#Gantt chart for daily schedule\n", "df = [\n", " dict(Task='Morning Sleep', Start='2016-01-01', Finish='2016-01-01 6:00:00', Resource='Sleep'),\n", " dict(Task='Breakfast', Start='2016-01-01 7:00:00', Finish='2016-01-01 7:30:00', Resource='Food'),\n", " dict(Task='Work', Start='2016-01-01 9:00:00', Finish='2016-01-01 11:25:00', Resource='Brain'),\n", " dict(Task='Break', Start='2016-01-01 11:30:00', Finish='2016-01-01 12:00:00', Resource='Rest'),\n", " dict(Task='Lunch', Start='2016-01-01 12:00:00', Finish='2016-01-01 13:00:00', Resource='Food'),\n", " dict(Task='Work', Start='2016-01-01 13:00:00', Finish='2016-01-01 17:00:00', Resource='Brain'),\n", " dict(Task='Exercise', Start='2016-01-01 17:30:00', Finish='2016-01-01 18:30:00', Resource='Cardio'), \n", " dict(Task='Post Workout Rest', Start='2016-01-01 18:30:00', Finish='2016-01-01 19:00:00', Resource='Rest'),\n", " dict(Task='Dinner', Start='2016-01-01 19:00:00', Finish='2016-01-01 20:00:00', Resource='Food'),\n", " dict(Task='Evening Sleep', Start='2016-01-01 21:00:00', Finish='2016-01-01 23:59:00', Resource='Sleep')\n", "]\n", "\n", "colors = dict(Cardio = 'rgb(46, 137, 205)',\n", " Food = 'rgb(114, 44, 121)',\n", " Sleep = 'rgb(198, 47, 105)',\n", " Brain = 'rgb(58, 149, 136)',\n", " Rest = 'rgb(107, 127, 135)')\n", "\n", "fig = FF.create_gantt(df, colors=colors, index_col='Resource', title='Daily Schedule',\n", " show_colorbar=True, bar_width=0.8, showgrid_x=True, showgrid_y=True)\n", "offline.iplot(fig, filename='gantt-hours-minutes')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "81eef434-fa97-4ffe-b35d-e7a268d1fb38" } }, "outputs": [], "source": [ "# Overlaid histogram\n", "x0 = np.random.randn(500)\n", "x1 = np.random.randn(500)+1\n", "\n", "trace1 = go.Histogram(\n", " x=x0,\n", " opacity=0.75\n", ")\n", "trace2 = go.Histogram(\n", " x=x1,\n", " opacity=0.75\n", ")\n", "\n", "data = [trace1, trace2]\n", "layout = go.Layout(barmode='overlay')\n", "fig = go.Figure(data=data, layout=layout)\n", "\n", "offline.iplot(fig, filename='overlaid histogram')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Custom Scatter plots with colorscale\n", "import numpy as np\n", "y1 = np.random.randn(500)\n", "trace1 = go.Scatter(\n", " y = y1,\n", " mode='markers',\n", " marker=dict(\n", " size='16',\n", " color = y1, #set color equal to a variable\n", " colorscale='Viridis',\n", " showscale=True\n", " )\n", ")\n", "data = [trace1]\n", "\n", "offline.iplot(data, filename='scatter-plot-with-colorscale')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "37e2a826-71ce-46a0-8b57-a347cdeff051" } }, "outputs": [], "source": [ "# Heatmap\n", "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "\n", "data = [\n", " go.Heatmap(\n", " z=[[1, 20, 30],\n", " [20, 1, 60],\n", " [30, 60, 1]]\n", " )\n", "]\n", "offline.iplot(data, filename='basic-heatmap')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "f170dd89-bc3e-4cdd-bd1d-3bc0309ccaa3" }, "slideshow": { "slide_type": "slide" } }, "outputs": [], "source": [ "# Streamline plot\n", "import plotly.figure_factory as FF\n", "import numpy as np\n", "\n", "N = 50\n", "x_start, x_end = -2.0, 2.0\n", "y_start, y_end = -1.0, 1.0\n", "x = np.linspace(x_start, x_end, N)\n", "y = np.linspace(y_start, y_end, N)\n", "X, Y = np.meshgrid(x, y)\n", "source_strength = 5.0\n", "x_source, y_source = -1.0, 0.0\n", "\n", "# Compute the velocity field on the mesh grid\n", "u = (source_strength/(2*np.pi) *\n", " (X-x_source)/((X-x_source)**2 + (Y-y_source)**2))\n", "v = (source_strength/(2*np.pi) *\n", " (Y-y_source)/((X-x_source)**2 + (Y-y_source)**2))\n", "\n", "# Create streamline figure\n", "fig = FF.create_streamline(x, y, u, v,\n", " name='streamline')\n", "\n", "# Add source point\n", "source_point = go.Scatter(x=[x_source], y=[y_source],\n", " mode='markers',\n", " marker=go.Marker(size=14),\n", " name='source point')\n", "\n", "# Add source point to figure\n", "fig['data'].append(source_point)\n", "offline.iplot(fig, filename='streamline_source')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Time series plot\n", "import pandas as pd\n", "\n", "#df = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv\")\n", "df = pd.read_csv('finance-charts-apple.csv')\n", "\n", "trace_high = go.Scatter(\n", " x=df.Date,\n", " y=df['AAPL.High'],\n", " name = \"AAPL High\",\n", " line = dict(color = '#17BECF'),\n", " opacity = 0.8)\n", "\n", "trace_low = go.Scatter(\n", " x=df.Date,\n", " y=df['AAPL.Low'],\n", " name = \"AAPL Low\",\n", " line = dict(color = '#7F7F7F'),\n", " opacity = 0.8)\n", "\n", "data = [trace_high,trace_low]\n", "\n", "layout = dict(\n", " title = \"Manually Set Date Range\",\n", " xaxis = dict(\n", " range = ['2016-07-01','2016-12-31'])\n", ")\n", "\n", "fig = dict(data=data, layout=layout)\n", "offline.iplot(fig, filename = \"Manually Set Range\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualizing Large Data" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "c516d8f4-7592-4bae-a21a-5d8856d251a2" } }, "outputs": [], "source": [ "# Webgl acceleration example and open in browser\n", "N = 100000\n", "trace = go.Scatter(\n", " x = np.random.randn(N),\n", " y = np.random.randn(N),\n", " mode = 'markers',\n", " marker = dict(\n", " color = 'FFBAD2',\n", " line = dict(width = 1)\n", " )\n", ")\n", "data = [trace]\n", "offline.plot(data, filename='compare_nowebgl.html')\n", "\n", "trace = go.Scattergl(\n", " x = np.random.randn(N),\n", " y = np.random.randn(N),\n", " mode = 'markers',\n", " marker = dict(\n", " color = 'FFBAD2',\n", " line = dict(width = 1)\n", " )\n", ")\n", "data = [trace]\n", "offline.plot(data, filename='compare_webgl.html')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Geographic Data" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "095f2091-b4b0-48b4-a927-0bdef4489550" } }, "outputs": [], "source": [ "# Maps using choropleth - reference at https://plot.ly/python/reference/#choropleth\n", "# Plot the agricultural exports by state\n", "# Example needs internet connectivity\n", "import pandas as pd\n", "\n", "#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv')\n", "df = pd.read_csv('2011_us_ag_exports.csv')\n", "\n", "for col in df.columns:\n", " df[col] = df[col].astype(str)\n", "\n", "#Create colorscale \n", "scl = [[0.0, 'rgb(242,240,247)'],[0.2, 'rgb(218,218,235)'],[0.4, 'rgb(188,189,220)'],\\\n", " [0.6, 'rgb(158,154,200)'],[0.8, 'rgb(117,107,177)'],[1.0, 'rgb(84,39,143)']]\n", "\n", "# Text to be displayed when hovering\n", "df['text'] = df['state'] + '
' +\\\n", " 'Beef '+df['beef']+' Dairy '+df['dairy']+'
'+\\\n", " 'Fruits '+df['total fruits']+' Veggies ' + df['total veggies']+'
'+\\\n", " 'Wheat '+df['wheat']+' Corn '+df['corn']\n", "\n", " \n", "# Reference values can be found here http://plot.ly/python/reference/#scattergeo \n", "data = [ dict(\n", " type='choropleth',\n", " colorscale = scl,\n", " autocolorscale = False, \n", " locations = df['code'],\n", " z = df['total exports'].astype(float), # Color by this variable\n", " locationmode = 'USA-states',\n", " text = df['text'],\n", " #hoverinfo = \"location+z\",\n", " marker = dict(\n", " line = dict (\n", " color = 'rgb(255,255,255)',\n", " width = 2\n", " ) ),\n", " colorbar = dict(\n", " title = \"Millions USD\")\n", " ) ]\n", "\n", "layout = dict(\n", " title = '2011 US Agriculture Exports by State
(Hover for breakdown)',\n", " geo = dict(\n", " scope='usa',\n", " projection=dict( type='albers usa' ),\n", " showlakes = True,\n", " lakecolor = 'rgb(255, 255, 0)'),\n", " )\n", " \n", "fig = dict( data=data, layout=layout )\n", "offline.iplot( fig, filename='d3-cloropleth-map' )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "3b1d839b-e020-4496-951c-22bf69ab9cea" } }, "outputs": [], "source": [ "# Bubble plot using 'scattergeo' Maps for US City population\n", "#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_us_cities.csv')\n", "df = pd.read_csv('2014_us_cities.csv')\n", "df.head()\n", "\n", "df['text'] = df['name'] + '
Population ' + (df['pop']/1e6).astype(str)+' million'\n", "# Create the grouping for cities\n", "limits = [(0,2),(3,10),(11,20),(21,50),(50,3000)]\n", "# Colormaps for the grouping\n", "colors = [\"rgb(0,116,217)\",\"rgb(255,65,54)\",\"rgb(133,20,75)\",\"rgb(255,133,27)\",\"lightgrey\"]\n", "cities = []\n", "scale = 5000\n", "\n", "# Loop over the grouping\n", "for i in range(len(limits)):\n", " lim = limits[i]\n", " # Extract subsets that belong to the grouping\n", " df_sub = df[lim[0]:lim[1]]\n", " city = dict(\n", " type = 'scattergeo',\n", " locationmode = 'USA-states',\n", " lon = df_sub['lon'],\n", " lat = df_sub['lat'],\n", " text = df_sub['text'],\n", " marker = dict(\n", " size = df_sub['pop']/scale, # Size corresponds to population\n", " color = colors[i], # Color depends on the grouping\n", " line = dict(width=0.5, color='rgb(40,40,40)'),\n", " sizemode = 'area'\n", " ),\n", " # legend name\n", " name = '{0} - {1}'.format(lim[0],lim[1]) \n", " )\n", " cities.append(city)\n", "\n", "layout = dict(\n", " title = '2014 US city populations
(Click legend to toggle traces)',\n", " showlegend = True,\n", " geo = dict(\n", " scope='usa',\n", " projection=dict( type='albers usa' ),\n", " showland = True,\n", " landcolor = 'rgb(217, 217, 217)',\n", " subunitwidth=1,\n", " countrywidth=1,\n", " subunitcolor=\"rgb(255, 255, 255)\",\n", " countrycolor=\"rgb(255, 255, 255)\"\n", " ),\n", " )\n", "\n", "fig = dict( data=cities, layout=layout )\n", "offline.iplot( fig, validate=False, filename='d3-bubble-map-populations' )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "46eaf1dd-08a2-4456-901a-2488c5059873" }, "scrolled": false }, "outputs": [], "source": [ "# Lines on Maps\n", "import pandas as pd\n", "\n", "#df_airports = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')\n", "df_airports = pd.read_csv('2011_february_us_airport_traffic.csv')\n", "df_airports.head()\n", "\n", "#df_flight_paths = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_aa_flight_paths.csv')\n", "df_flight_paths = pd.read_csv('2011_february_aa_flight_paths.csv')\n", "df_flight_paths.head()\n", "\n", "airports = [ dict(\n", " type = 'scattergeo',\n", " locationmode = 'USA-states',\n", " lon = df_airports['long'],\n", " lat = df_airports['lat'],\n", " hoverinfo = 'text',\n", " text = df_airports['airport'],\n", " mode = 'markers',\n", " marker = dict( \n", " size=2, \n", " color='rgb(255, 0, 0)',\n", " line = dict(\n", " width=3,\n", " color='rgba(68, 68, 68, 0)'\n", " )\n", " ))]\n", " \n", "flight_paths = []\n", "for i in range( len( df_flight_paths ) ):\n", " flight_paths.append(\n", " dict(\n", " type = 'scattergeo',\n", " locationmode = 'USA-states',\n", " lon = [ df_flight_paths['start_lon'][i], df_flight_paths['end_lon'][i] ],\n", " lat = [ df_flight_paths['start_lat'][i], df_flight_paths['end_lat'][i] ],\n", " mode = 'lines',\n", " line = dict(\n", " width = 1,\n", " color = 'red',\n", " ),\n", " opacity = float(df_flight_paths['cnt'][i])/float(df_flight_paths['cnt'].max()),\n", " )\n", " )\n", " \n", "layout = dict(\n", " title = 'Feb. 2011 American Airline flight paths
(Hover for airport names)',\n", " showlegend = False, \n", " geo = dict(\n", " scope='north america',\n", " projection=dict( type='azimuthal equal area' ),\n", " showland = True,\n", " landcolor = 'rgb(243, 243, 243)',\n", " countrycolor = 'rgb(204, 204, 204)',\n", " ),\n", " )\n", " \n", "fig = dict( data=flight_paths + airports, layout=layout )\n", "offline.iplot( fig, filename='d3-flight-paths' )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "73658619-2b26-4410-8183-17bc02e3a281" } }, "outputs": [], "source": [ "# Contours on Globe\n", "import pandas as pd\n", "\n", "try:\n", " # Python 2\n", " from itertools import izip\n", "except ImportError:\n", " # Python 3\n", " izip = zip\n", "\n", "#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/globe_contours.csv')\n", "df = pd.read_csv('globe_contours.csv')\n", "df.head()\n", "\n", "contours = []\n", "\n", "scl = ['rgb(213,62,79)','rgb(244,109,67)','rgb(253,174,97)',\\\n", " 'rgb(254,224,139)','rgb(255,255,191)','rgb(230,245,152)',\\\n", " 'rgb(171,221,164)','rgb(102,194,165)','rgb(50,136,189)']\n", "\n", "def pairwise(iterable):\n", " a = iter(iterable)\n", " return izip(a, a)\n", "\n", "i=0\n", "for lat, lon in pairwise(df.columns):\n", " contours.append( dict(\n", " type = 'scattergeo',\n", " lon = df[lon],\n", " lat = df[lat],\n", " mode = 'lines',\n", " line = dict(\n", " width = 2,\n", " color = scl[i]\n", " )\n", " ) )\n", " i = 0 if i+1 >= len(df.columns)/4 else i+1\n", " \n", "layout = dict(\n", " title = 'Contour lines over globe
(Click and drag to rotate)',\n", " showlegend = False, \n", " geo = dict(\n", " showland = True,\n", " showlakes = True,\n", " showcountries = True,\n", " showocean = True,\n", " countrywidth = 0.5,\n", " landcolor = 'rgb(230, 145, 56)',\n", " lakecolor = 'rgb(0, 255, 255)',\n", " oceancolor = 'rgb(0, 255, 255)',\n", " projection = dict( \n", " type = 'orthographic',\n", " rotation = dict(\n", " lon = -100,\n", " lat = 40,\n", " roll = 0\n", " ) \n", " ),\n", " lonaxis = dict( \n", " showgrid = True,\n", " gridcolor = 'rgb(102, 102, 102)',\n", " gridwidth = 0.5\n", " ),\n", " lataxis = dict( \n", " showgrid = True,\n", " gridcolor = 'rgb(102, 102, 102)',\n", " gridwidth = 0.5\n", " )\n", " )\n", " )\n", " \n", "fig = dict( data=contours, layout=layout )\n", "offline.iplot( fig, filename='d3-globe' )\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "c587bbf0-ea08-467c-97b7-cdae573666f8" } }, "outputs": [], "source": [ "# Mapbox maps\n", "# Requires internet access\n", "from plotly.graph_objs import *\n", "mapbox_access_token = 'pk.eyJ1Ijoic2pzdGVyIiwiYSI6ImNpenhicTltNDAyMWszM21teDdyNGN2MGkifQ.PRQ-gQrsIU8xSHYwa5aJAA'\n", "\n", "data = Data([\n", " Scattermapbox(\n", " #lat=['45.5017'],\n", " #lon=['-73.5673'],\n", " lat=['37.2'],\n", " lon=['-80.4'],\n", " mode='markers',\n", " marker=Marker(\n", " size=14\n", " ),\n", " #text=['Montreal'],\n", " text=['Blacksburg'],\n", " )\n", "])\n", "\n", "layout = Layout(\n", " autosize=True,\n", " hovermode='closest',\n", " # Specification for map\n", " mapbox=dict(\n", " accesstoken=mapbox_access_token,\n", " bearing=0,\n", " center=dict(\n", " #lat=45,\n", " #lon=-73\n", " lat = 37.2,\n", " lon = -80.4\n", " ),\n", " pitch=0,\n", " zoom=5\n", " ),\n", ")\n", "\n", "fig = dict(data=data, layout=layout)\n", "offline.iplot(fig, filename='Blacksburg Mapbox', validate=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3D Visualization" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "27a99eb8-dadf-4cd8-9005-090ae715fc9a" } }, "outputs": [], "source": [ "# 3D plots with Torus\n", "from scipy.spatial import Delaunay\n", "\n", "u = np.linspace(0, 2*np.pi, 20)\n", "v = np.linspace(0, 2*np.pi, 20)\n", "u,v = np.meshgrid(u,v)\n", "u = u.flatten()\n", "v = v.flatten()\n", "\n", "x = (3 + (np.cos(v)))*np.cos(u)\n", "y = (3 + (np.cos(v)))*np.sin(u)\n", "z = np.sin(v)\n", "\n", "points2D = np.vstack([u,v]).T\n", "tri = Delaunay(points2D)\n", "simplices = tri.simplices\n", "\n", "fig1 = FF.create_trisurf(x=x, y=y, z=z,\n", " simplices=simplices,\n", " title=\"Torus\", aspectratio=dict(x=1, y=1, z=0.5))\n", "offline.iplot(fig1, filename=\"3dFolder/Torus\")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "simplices" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "fa04db69-404f-451d-9096-0358ab27e364" }, "scrolled": false }, "outputs": [], "source": [ "# 3D bubble chart\n", "#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')\n", "df = pd.read_csv('gapminderDataFiveYear.csv')\n", "\n", "trace1 = go.Scatter3d(\n", " x=df['year'][750:1500],\n", " y=df['continent'][750:1500],\n", " z=df['pop'][750:1500],\n", " text=df['country'][750:1500],\n", " mode='markers',\n", " marker=dict(\n", " sizemode='diameter',\n", " sizeref=750,\n", " size=df['gdpPercap'][750:1500],\n", " color = df['lifeExp'][750:1500],\n", " colorscale = 'Viridis',\n", " colorbar = dict(title = 'Life
Expectancy'),\n", " line=dict(color='rgb(140, 140, 170)')\n", " )\n", ")\n", "\n", "data=[trace1]\n", "layout=dict(height=800, width=800, title='Examining Population and Life Expectancy Over Time')\n", "fig=dict(data=data, layout=layout)\n", "offline.iplot(fig, filename='3DBubble')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "df[750:1500]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbpresent": { "id": "cdb00f0a-0b2d-4aa6-a298-39be1605acce" } }, "outputs": [], "source": [ "# 3D Topographic\n", "import pandas as pd\n", "#z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')\n", "z_data = pd.read_csv('mt_bruno_elevation.csv')\n", "\n", "data = [\n", " go.Surface(\n", " z=z_data.as_matrix()\n", " )\n", "]\n", "layout = go.Layout(\n", " title='Mt Bruno Elevation',\n", " autosize=False,\n", " width=500,\n", " height=500\n", ")\n", "fig = go.Figure(data=data, layout=layout)\n", "offline.iplot(fig, filename='elevations-3d-surface')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "z_data.as_matrix()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Network Visualization" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "scrolled": false }, "outputs": [], "source": [ "import networkx as nx\n", "import matplotlib.pyplot as plt\n", "from plotly.graph_objs import *\n", "G=nx.Graph()# G is an empty Graph\n", "\n", "Nodes=range(9)\n", "G.add_nodes_from(Nodes)\n", "Edges=[(0,1), (0,2), (1,3), (1,4), (1,7), (2,5), (2,8), (3, 4), (3,5),(4,6), (4,7), (4,8), (5,7)]\n", "G.add_edges_from(Edges)\n", "G.add_edge(6,8)\n", "\n", "pos1=nx.spring_layout(G)\n", "print(pos1)\n", "dir(G)\n", "\n", "def scatter_nodes(pos, labels=None, color=None, size=20, opacity=1):\n", " # pos is the dict of node positions\n", " # labels is a list of labels of len(pos), to be displayed when hovering the mouse over the nodes\n", " # color is the color for nodes. When it is set as None the Plotly default color is used\n", " # size is the size of the dots representing the nodes\n", " #opacity is a value between [0,1] defining the node color opacity\n", " L=len(pos)\n", " trace = Scatter(x=[], y=[], mode='markers', marker=Marker(size=[]))\n", " for k in range(L):\n", " trace['x'].append(pos[k][0])\n", " trace['y'].append(pos[k][1])\n", " attrib=dict(name='', text=labels , hoverinfo='text', opacity=opacity) # a dict of Plotly node attributes\n", " trace=dict(trace, **attrib)# concatenate the dict trace and attrib\n", " trace['marker']['size']=size\n", " return trace\n", "\n", "def scatter_edges(G, pos, line_color=None, line_width=1):\n", " trace = Scatter(x=[], y=[], mode='lines')\n", " for edge in G.edges():\n", " trace['x'] += [pos[edge[0]][0],pos[edge[1]][0], None]\n", " trace['y'] += [pos[edge[0]][1],pos[edge[1]][1], None] \n", " trace['hoverinfo']='none'\n", " trace['line']['width']=line_width\n", " if line_color is not None: # when it is None a default Plotly color is used\n", " trace['line']['color']=line_color\n", " return trace\n", "\n", "\n", "pos=nx.fruchterman_reingold_layout(G)\n", "labels=[str(k) for k in range(len(pos))] # labels are set as being the nodes indices in the list of nodes\n", "labels=['Fred', 'Alice', 'Bob', 'Anna', 'Frida', 'Andrew', 'Jack', 'Maria','James']\n", "trace1=scatter_edges(G, pos)\n", "trace2=scatter_nodes(pos, labels=labels)\n", "\n", "width=500\n", "height=500\n", "axis=dict(showline=False, # hide axis line, grid, ticklabels and title\n", " zeroline=False,\n", " showgrid=False,\n", " showticklabels=False,\n", " title='' \n", " )\n", "layout=Layout(title= 'Fruchterman Reingold layout', #\n", " showlegend=False,\n", " autosize=False,\n", " width=width,\n", " height=height,\n", " xaxis=XAxis(axis),\n", " yaxis=YAxis(axis),\n", " hovermode='closest',\n", " plot_bgcolor='#EFECEA', #set background color \n", " )\n", "\n", "\n", "data=Data([trace1, trace2])\n", "\n", "fig = Figure(data=data, layout=layout)\n", "offline.iplot(fig, filename='tst')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import networkx as nx\n", "\n", "Ad=np.array([[0,1,1,1,0,0,0,1], # Adjacency matrix\n", " [1,0,1,0,1,1,1,0],\n", " [1,1,0,0,0,0,1,1],\n", " [1,0,0,0,1,1,1,1],\n", " [0,1,0,1,0,1,1,0],\n", " [0,1,0,1,1,0,1,0],\n", " [0,1,1,1,1,1,0,1],\n", " [1,0,1,1,0,0,1,0]], dtype=float)\n", "Gr=nx.from_numpy_matrix(Ad)\n", "print('List of nodes:\\n', Gr.nodes(), '\\n', 'List of edges:\\n', Gr.edges())\n", "position=nx.spring_layout(Gr)\n", "labels=['Fred', 'Alice', 'Bob', 'Anna', 'Frida', 'Andrew', 'Jack', 'Maria']\n", "traceE=scatter_edges(Gr, position)\n", "traceN=scatter_nodes(position, labels=labels)\n", "layout.update(title='Friendship Network')\n", "data1=Data([traceE, traceN])\n", "fig = Figure(data=data1, layout=layout) \n", "offline.iplot(fig, filename='Network-2N')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" }, "nbpresent": { "slides": { "02aaa50f-3a71-428d-a31a-81b44cff0970": { "id": "02aaa50f-3a71-428d-a31a-81b44cff0970", "prev": "2ef37d14-3250-4d16-84bc-0eab8d8fd814", "regions": { "3e6a511e-c0c5-4e67-92c8-9808ebf74a0d": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "fb994501-a54e-4dff-8ead-20846c9e989d", "part": "whole" }, "id": "3e6a511e-c0c5-4e67-92c8-9808ebf74a0d" } } }, "103269dc-feff-4ddf-950d-4daebecda735": { "id": "103269dc-feff-4ddf-950d-4daebecda735", "prev": "7c9c8f3a-7a9c-43a4-8468-1afad1c89352", "regions": { "7f834704-4eed-408d-baa5-fa8712551842": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "15b33e68-3d5b-42b6-8a76-25ff8bfefa08", "part": "whole" }, "id": "7f834704-4eed-408d-baa5-fa8712551842" } } }, "11fc9ac2-46f1-42e2-9e24-acecb38bfdff": { "id": "11fc9ac2-46f1-42e2-9e24-acecb38bfdff", "prev": "d9bf5263-f0fd-48ea-98ab-42f4b3e74418", "regions": { "38ca99c5-27cf-4cc9-a269-f5253b66695e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a77f8299-c1de-44f7-9ed0-af08f6002a3a", "part": "whole" }, "id": "38ca99c5-27cf-4cc9-a269-f5253b66695e" } } }, "135b4ec5-a07e-4305-a3ca-d1efcf5d4190": { "id": "135b4ec5-a07e-4305-a3ca-d1efcf5d4190", "prev": "dc351fd9-15ca-4f42-a9bb-0832a602bbf5", "regions": { "36c0d0ae-0618-4626-b49d-2b142b038c2b": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a9c8f359-e0ee-4833-85ee-bc8fd0477c16", "part": "whole" }, "id": "36c0d0ae-0618-4626-b49d-2b142b038c2b" } } }, "1b5aada0-56d4-4c61-957c-35c5e234c48f": { "id": "1b5aada0-56d4-4c61-957c-35c5e234c48f", "prev": "fd391e87-3efb-492f-b882-941366c9f115", "regions": { "dd6d5f6c-d437-42ed-8cb1-01fa2cccc4c4": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "ad887351-2213-4e18-980b-37e560b0bc8a", "part": "whole" }, "id": "dd6d5f6c-d437-42ed-8cb1-01fa2cccc4c4" } } }, "2ef37d14-3250-4d16-84bc-0eab8d8fd814": { "id": "2ef37d14-3250-4d16-84bc-0eab8d8fd814", "prev": "5f6cfdc3-0006-45bf-b63f-d3faff94ba11", "regions": { "3646eeef-8928-478d-8c89-723f4b78baba": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "83019633-23a4-4355-89ea-9299bc22a391", "part": "whole" }, "id": "3646eeef-8928-478d-8c89-723f4b78baba" } } }, "31556780-94c1-4f96-8b27-1b645d596ac5": { "id": "31556780-94c1-4f96-8b27-1b645d596ac5", "prev": "df90b895-b76a-48cc-a8f3-d22fc792cd4f", "regions": { "f1d592c5-6f50-4d9e-8f42-60875c653a99": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "19346ef7-c4ef-4698-a28a-24157023cd82", "part": "whole" }, "id": "f1d592c5-6f50-4d9e-8f42-60875c653a99" } } }, "3517cd99-7bdc-465b-ba1e-438f6c6091dd": { "id": "3517cd99-7bdc-465b-ba1e-438f6c6091dd", "prev": "b412e7c8-890f-4e63-a5db-cc12a92348be", "regions": { "a24b9aad-b258-477b-9c1a-0f8df6653392": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "79b29f7e-f5e0-4f01-8726-a385d879c5e0", "part": "whole" }, "id": "a24b9aad-b258-477b-9c1a-0f8df6653392" } } }, "574ed4aa-a375-419a-9977-46d9e88739b0": { "id": "574ed4aa-a375-419a-9977-46d9e88739b0", "prev": "cd6f6c1e-ac69-4d41-8fa3-270437428c79", "regions": { "a175b255-815d-484f-b503-48afbe1d5fc8": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a9e6029b-002c-4d50-8e3f-c97db7f03f40", "part": "whole" }, "id": "a175b255-815d-484f-b503-48afbe1d5fc8" } } }, "5f6cfdc3-0006-45bf-b63f-d3faff94ba11": { "id": "5f6cfdc3-0006-45bf-b63f-d3faff94ba11", "prev": "ae96e2a6-aeb7-4513-ac9d-b51f305d7d0f", "regions": { "5fd329e0-559f-477e-a563-caf667b9129d": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cd810103-4609-4d09-a86c-6a1e23d9a11a", "part": "whole" }, "id": "5fd329e0-559f-477e-a563-caf667b9129d" } } }, "626a82ce-fb36-41a0-a6ae-d3f0d0735af7": { "id": "626a82ce-fb36-41a0-a6ae-d3f0d0735af7", "prev": "a067e9b9-5b27-4054-8a8d-2ab064cf2a82", "regions": { "94bed982-2ff2-4e08-a06a-229f176abaa5": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a78a37a9-469c-4c19-a7c4-266e2002c3aa", "part": "whole" }, "id": "94bed982-2ff2-4e08-a06a-229f176abaa5" } } }, "6e7d0ad0-6186-4b4a-8298-f52ac18da2be": { "id": "6e7d0ad0-6186-4b4a-8298-f52ac18da2be", "prev": "3517cd99-7bdc-465b-ba1e-438f6c6091dd", "regions": { "efe19ad3-ae44-4fea-af71-9f2ca8babca8": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "0c03b3fd-e2e2-46ab-979f-db89039e8c39", "part": "whole" }, "id": "efe19ad3-ae44-4fea-af71-9f2ca8babca8" } } }, "7c9c8f3a-7a9c-43a4-8468-1afad1c89352": { "id": "7c9c8f3a-7a9c-43a4-8468-1afad1c89352", "prev": "7d79047f-e60b-4b50-b94d-645a42f8ae69", "regions": { "362a0b66-4bb2-4ff7-a8bf-b06b38ce03c4": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "6a58dc64-b71c-4fd3-9527-8d1783dbbd54", "part": "whole" }, "id": "362a0b66-4bb2-4ff7-a8bf-b06b38ce03c4" } } }, "7d24c9c2-7335-4fe9-9b09-e7d7cfba860e": { "id": "7d24c9c2-7335-4fe9-9b09-e7d7cfba860e", "prev": "88b08178-24bd-4405-8af2-9b0d8701fa48", "regions": { "b7f168ce-15a6-46fd-b914-697442bfa2c5": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "4afb11dd-4e9d-4864-a183-e6343395035c", "part": "whole" }, "id": "b7f168ce-15a6-46fd-b914-697442bfa2c5" } } }, "7d79047f-e60b-4b50-b94d-645a42f8ae69": { "id": "7d79047f-e60b-4b50-b94d-645a42f8ae69", "prev": "93ff19e3-6a9c-4061-9ab1-f737e26dc89b", "regions": { "b52bad51-3fd5-4db7-9297-59eae0157e01": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f21b9ef2-4147-4d06-8ff0-bc3614f179fb", "part": "whole" }, "id": "b52bad51-3fd5-4db7-9297-59eae0157e01" } } }, "88b08178-24bd-4405-8af2-9b0d8701fa48": { "id": "88b08178-24bd-4405-8af2-9b0d8701fa48", "prev": "574ed4aa-a375-419a-9977-46d9e88739b0", "regions": { "a6f69e63-7407-4515-9fe6-d2fef851e4d8": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "fba20da1-817a-4163-a519-0d0d57b93acf", "part": "whole" }, "id": "a6f69e63-7407-4515-9fe6-d2fef851e4d8" } } }, "93ff19e3-6a9c-4061-9ab1-f737e26dc89b": { "id": "93ff19e3-6a9c-4061-9ab1-f737e26dc89b", "prev": "31556780-94c1-4f96-8b27-1b645d596ac5", "regions": { "6db991e6-c510-4c65-9c9f-37317294e9a9": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c51b5b52-2486-4b35-a5a9-af31ccec3e13", "part": "whole" }, "id": "6db991e6-c510-4c65-9c9f-37317294e9a9" } } }, "99b240aa-ba3f-4ada-95f6-b48087748f46": { "id": "99b240aa-ba3f-4ada-95f6-b48087748f46", "prev": "ca8f03f8-df53-444c-b0b5-bb94da674bac", "regions": { "9f9e3386-5351-4326-a0f5-0f834beb9d94": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "fa04db69-404f-451d-9096-0358ab27e364", "part": "whole" }, "id": "9f9e3386-5351-4326-a0f5-0f834beb9d94" } } }, "a067e9b9-5b27-4054-8a8d-2ab064cf2a82": { "id": "a067e9b9-5b27-4054-8a8d-2ab064cf2a82", "prev": "6e7d0ad0-6186-4b4a-8298-f52ac18da2be", "regions": { "d37a2e85-34f3-4e12-a17a-13ab89f96130": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "13d4a2ed-1ed7-4ed7-83b9-bb8e97927ee2", "part": "whole" }, "id": "d37a2e85-34f3-4e12-a17a-13ab89f96130" } } }, "a2fb3bab-d41d-4dbe-836c-4c96a8810aa7": { "id": "a2fb3bab-d41d-4dbe-836c-4c96a8810aa7", "prev": "e890cc79-9bbf-4d8b-9fe4-64a0c6e0fb66", "regions": { "de1ec2a1-8c1c-4298-ac7f-71c39108651a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "8fe2507e-e241-4772-a5e7-2b1f7ceeef22", "part": "whole" }, "id": "de1ec2a1-8c1c-4298-ac7f-71c39108651a" } } }, "a50efdc5-a958-4d17-960c-629fbe3c1620": { "id": "a50efdc5-a958-4d17-960c-629fbe3c1620", "prev": "c7fa8e04-57f4-42c4-ac53-dae85eadade2", "regions": { "8f040231-36a2-4816-8d53-2471ae2fde96": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c587bbf0-ea08-467c-97b7-cdae573666f8", "part": "whole" }, "id": "8f040231-36a2-4816-8d53-2471ae2fde96" } } }, "ac04bad5-7a8a-4951-877a-5e937ecf2862": { "id": "ac04bad5-7a8a-4951-877a-5e937ecf2862", "prev": "c740307c-34f6-4f07-8d4d-a12bfaf783bb", "regions": { "d12261e4-4172-4d46-84c4-64f64f666324": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "46eaf1dd-08a2-4456-901a-2488c5059873", "part": "whole" }, "id": "d12261e4-4172-4d46-84c4-64f64f666324" } } }, "ae96e2a6-aeb7-4513-ac9d-b51f305d7d0f": { "id": "ae96e2a6-aeb7-4513-ac9d-b51f305d7d0f", "prev": "11fc9ac2-46f1-42e2-9e24-acecb38bfdff", "regions": { "83f7fae4-5acf-4ab0-9fa8-11de00d35ad0": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f770b49c-64cb-41ff-b699-8fdd8c9996e2", "part": "whole" }, "id": "83f7fae4-5acf-4ab0-9fa8-11de00d35ad0" } } }, "b412e7c8-890f-4e63-a5db-cc12a92348be": { "id": "b412e7c8-890f-4e63-a5db-cc12a92348be", "prev": "a2fb3bab-d41d-4dbe-836c-4c96a8810aa7", "regions": { "13f218ea-8585-4208-be31-8a9da0732af0": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "ef0968b5-617c-426c-8e37-7a5e82556211", "part": "whole" }, "id": "13f218ea-8585-4208-be31-8a9da0732af0" } } }, "c28fb58d-aaf9-43d2-9373-195eaa564b2c": { "id": "c28fb58d-aaf9-43d2-9373-195eaa564b2c", "prev": null, "regions": { "7736cd79-b120-4293-8f37-f37cf5d278b3": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f460683a-b1fb-4647-997b-b5873eb6950f", "part": "whole" }, "id": "7736cd79-b120-4293-8f37-f37cf5d278b3" } } }, "c740307c-34f6-4f07-8d4d-a12bfaf783bb": { "id": "c740307c-34f6-4f07-8d4d-a12bfaf783bb", "prev": "cc7bd270-14ed-4de8-9f82-0c41182021c3", "regions": { "552338b5-6d6c-49cc-9910-5b1cf297863a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "3b1d839b-e020-4496-951c-22bf69ab9cea", "part": "whole" }, "id": "552338b5-6d6c-49cc-9910-5b1cf297863a" } } }, "c7fa8e04-57f4-42c4-ac53-dae85eadade2": { "id": "c7fa8e04-57f4-42c4-ac53-dae85eadade2", "prev": "ac04bad5-7a8a-4951-877a-5e937ecf2862", "regions": { "31540436-bc11-4c12-9c81-9268fb4143b1": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "73658619-2b26-4410-8183-17bc02e3a281", "part": "whole" }, "id": "31540436-bc11-4c12-9c81-9268fb4143b1" } } }, "ca8f03f8-df53-444c-b0b5-bb94da674bac": { "id": "ca8f03f8-df53-444c-b0b5-bb94da674bac", "prev": "a50efdc5-a958-4d17-960c-629fbe3c1620", "regions": { "87b5989d-f1b6-4fa4-a75f-1613e72e5b85": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "27a99eb8-dadf-4cd8-9005-090ae715fc9a", "part": "whole" }, "id": "87b5989d-f1b6-4fa4-a75f-1613e72e5b85" } } }, "cc7bd270-14ed-4de8-9f82-0c41182021c3": { "id": "cc7bd270-14ed-4de8-9f82-0c41182021c3", "prev": "d7699ac7-b97e-439e-9679-d5fc60a17bc6", "regions": { "b6223e07-1808-4eae-b774-8ff997282f8e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "095f2091-b4b0-48b4-a927-0bdef4489550", "part": "whole" }, "id": "b6223e07-1808-4eae-b774-8ff997282f8e" } } }, "cd6f6c1e-ac69-4d41-8fa3-270437428c79": { "id": "cd6f6c1e-ac69-4d41-8fa3-270437428c79", "prev": "f104e004-8c49-4637-aa4b-d43494e2d653", "regions": { "a57e05a8-5263-4446-b9dd-230014c95b18": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "5329f851-3677-44ef-aac2-63f8d1d913d4", "part": "whole" }, "id": "a57e05a8-5263-4446-b9dd-230014c95b18" } } }, "d719bdb1-c5e4-4277-a3cc-04ee0d5ac158": { "id": "d719bdb1-c5e4-4277-a3cc-04ee0d5ac158", "prev": "135b4ec5-a07e-4305-a3ca-d1efcf5d4190", "regions": { "76d4c7a0-6883-45d4-b829-02994018de1d": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c516d8f4-7592-4bae-a21a-5d8856d251a2", "part": "whole" }, "id": "76d4c7a0-6883-45d4-b829-02994018de1d" } } }, "d7699ac7-b97e-439e-9679-d5fc60a17bc6": { "id": "d7699ac7-b97e-439e-9679-d5fc60a17bc6", "prev": "d719bdb1-c5e4-4277-a3cc-04ee0d5ac158", "regions": { "7ac7f0b6-ea88-48d4-be4c-a30b787ca4c9": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "37e2a826-71ce-46a0-8b57-a347cdeff051", "part": "whole" }, "id": "7ac7f0b6-ea88-48d4-be4c-a30b787ca4c9" } } }, "d9bf5263-f0fd-48ea-98ab-42f4b3e74418": { "id": "d9bf5263-f0fd-48ea-98ab-42f4b3e74418", "prev": "626a82ce-fb36-41a0-a6ae-d3f0d0735af7", "regions": { "5bec22c5-947d-43a6-93a4-7747d27bdb05": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f170dd89-bc3e-4cdd-bd1d-3bc0309ccaa3", "part": "whole" }, "id": "5bec22c5-947d-43a6-93a4-7747d27bdb05" } } }, "dc351fd9-15ca-4f42-a9bb-0832a602bbf5": { "id": "dc351fd9-15ca-4f42-a9bb-0832a602bbf5", "prev": "02aaa50f-3a71-428d-a31a-81b44cff0970", "regions": { "c9c680eb-3ed2-4d91-87a9-e11d9ca8fa9a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "81eef434-fa97-4ffe-b35d-e7a268d1fb38", "part": "whole" }, "id": "c9c680eb-3ed2-4d91-87a9-e11d9ca8fa9a" } } }, "df90b895-b76a-48cc-a8f3-d22fc792cd4f": { "id": "df90b895-b76a-48cc-a8f3-d22fc792cd4f", "prev": "c28fb58d-aaf9-43d2-9373-195eaa564b2c", "regions": { "b4eddeca-d10d-40fa-90e3-5a7468f3a99a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "bb68faea-3d34-499c-80e3-3b1ab763bc47", "part": "whole" }, "id": "b4eddeca-d10d-40fa-90e3-5a7468f3a99a" } } }, "e890cc79-9bbf-4d8b-9fe4-64a0c6e0fb66": { "id": "e890cc79-9bbf-4d8b-9fe4-64a0c6e0fb66", "prev": "1b5aada0-56d4-4c61-957c-35c5e234c48f", "regions": { "6d95559a-6822-49a3-b774-ffd56b651e72": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cc6ffa17-9a99-4c30-9e8c-47f8e9c43fea", "part": "whole" }, "id": "6d95559a-6822-49a3-b774-ffd56b651e72" } } }, "f104e004-8c49-4637-aa4b-d43494e2d653": { "id": "f104e004-8c49-4637-aa4b-d43494e2d653", "prev": "99b240aa-ba3f-4ada-95f6-b48087748f46", "regions": { "5f7b5c30-4f66-4501-8857-0b35cf9b3d5a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cdb00f0a-0b2d-4aa6-a298-39be1605acce", "part": "whole" }, "id": "5f7b5c30-4f66-4501-8857-0b35cf9b3d5a" } } }, "fd391e87-3efb-492f-b882-941366c9f115": { "id": "fd391e87-3efb-492f-b882-941366c9f115", "prev": "103269dc-feff-4ddf-950d-4daebecda735", "regions": { "3ea38394-9411-461e-8617-a31696b26435": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "1814cc62-c078-43b6-9c49-f49f99982fab", "part": "whole" }, "id": "3ea38394-9411-461e-8617-a31696b26435" } } } }, "themes": {} } }, "nbformat": 4, "nbformat_minor": 1 }