From c885df52b9a81e97d0b658655905fabedfcb79a9 Mon Sep 17 00:00:00 2001 From: Priyatharsan Rajasekar Date: Mon, 20 Aug 2018 14:49:25 -0400 Subject: [PATCH] HTML to ipynb update - matplotlib/static-image --- .../static-image/2015-06-30-static-image.html | 509 ++++++++++++++++++ ...016-02-22-static-image_matplotlib_index.md | 63 --- .../static-image/static-image.ipynb | 344 ++++++++++++ 3 files changed, 853 insertions(+), 63 deletions(-) create mode 100644 _posts/matplotlib/static-image/2015-06-30-static-image.html delete mode 100644 _posts/matplotlib/static-image/2016-02-22-static-image_matplotlib_index.md create mode 100644 _posts/matplotlib/static-image/static-image.ipynb diff --git a/_posts/matplotlib/static-image/2015-06-30-static-image.html b/_posts/matplotlib/static-image/2015-06-30-static-image.html new file mode 100644 index 000000000000..22e4709e12f8 --- /dev/null +++ b/_posts/matplotlib/static-image/2015-06-30-static-image.html @@ -0,0 +1,509 @@ +--- +permalink: matplotlib/static-image/ +description: How to export plotly matplotlib graphs as static images in Python. Plotly supports png, svg, jpg, and pdf image export. +name: Matplotlib Static Image Export +has_thumbnail: true +thumbnail: thumbnail/png-export.png +layout: user-guide +language: matplotlib +title: Matplotlib Static Image Export | Plotly +display_as: basic +has_thumbnail: true +page_type: example_index +order: 5 +ipynb: ~notebook_demo/232 +--- +{% raw %} +
+
+
+
+

New to Plotly?

Plotly's Python library is free and open source! Get started by downloading the client and reading the primer. +
You can set up Plotly to work in online or offline mode, or in jupyter notebooks. +
We also have a quick-reference cheatsheet (new!) to help you get started!

+ +
+
+
+
+
+
+
+

Version Check

Plotly's python package is updated frequently. Run pip install plotly --upgrade to use the latest version.

+ +
+
+
+
+
+
In [1]:
+
+
+
import plotly
+plotly.__version__
+
+ +
+
+
+ +
+
+ + +
+ +
Out[1]:
+ + + + +
+
'3.1.1'
+
+ +
+ +
+
+ +
+
+
+
In [2]:
+
+
+
# Import modules
+import plotly.plotly as py
+import plotly.tools as tls
+import matplotlib.pyplot as plt
+
+# Create a plot
+x = [1, 2]
+y = [2, 4]
+plt.plot(x, y)
+
+# Get Matplotlib Figure
+mpl_fig = plt.gcf() 
+
+# Convert to plotly figure
+plotly_fig = tls.mpl_to_plotly(mpl_fig) 
+
+# Save image
+py.image.save_as(plotly_fig, 'your_image_filename.png') 
+
+ +
+
+
+ +
+
+
+
+
+

In Addition, you can specify the size of the matplotlib/plotly figure to be saved by using following method:

+ +
+
+
+
+
+
In [4]:
+
+
+
import plotly.plotly as py
+py.image.save_as(plotly_fig, 'your_image_filename.png', height=desired_height, width=desired_width) 
+
+ +
+
+
+ +
+
+
+
+
+

You can also display inline static images in IPython:

+ +
+
+
+
+
+
In [5]:
+
+
+
import plotly.plotly as py
+py.image.ishow(plotly_fig)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

You can view the static version of any Plotly graph by appending .png, .pdf, .eps, or .svg to the end of the URL. For example, view the static image of https://plot.ly/~chris/1638 at https://plot.ly/~chris/1638.png.

+ +
+
+
+
+
+
+
+

Combine this with the requests package and download the latest version of your Plotly graph:

+ +
+
+
+
+
+
In [6]:
+
+
+
import requests
+image_bytes = requests.get('https://plot.ly/~chris/1638.png').content
+
+ +
+
+
+ +
+
+
+
+
+

Reference

+
+
+
+
+
+
+
+

See https://plot.ly/python/static-image-export/ for more information and chart attribute options!

+ +
+
+
+
+
+
In [7]:
+
+
+
help(py.image)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Help on class image in module plotly.plotly.plotly:
+
+class image
+ |  Helper functions wrapped around plotly's static image generation api.
+ |  
+ |  Class methods defined here:
+ |  
+ |  ishow(cls, figure_or_data, format='png', width=None, height=None, scale=None) from __builtin__.classobj
+ |      Display a static image of the plot described by `figure_or_data`
+ |      in an IPython Notebook.
+ |      
+ |      positional arguments:
+ |      - figure_or_data: The figure dict-like or data list-like object that
+ |                        describes a plotly figure.
+ |                        Same argument used in `py.plot`, `py.iplot`,
+ |                        see https://plot.ly/python for examples
+ |      - format: 'png', 'svg', 'jpeg', 'pdf'
+ |      - width: output width
+ |      - height: output height
+ |      - scale: Increase the resolution of the image by `scale` amount
+ |             Only valid for PNG and JPEG images.
+ |      
+ |      example:
+ |      ```
+ |      import plotly.plotly as py
+ |      fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}
+ |      py.image.ishow(fig, 'png', scale=3)
+ |  
+ |  save_as(cls, figure_or_data, filename, format=None, width=None, height=None, scale=None) from __builtin__.classobj
+ |      Save a image of the plot described by `figure_or_data` locally as
+ |      `filename`.
+ |      
+ |      Valid image formats are 'png', 'svg', 'jpeg', and 'pdf'.
+ |      The format is taken as the extension of the filename or as the
+ |      supplied format.
+ |      
+ |      positional arguments:
+ |      - figure_or_data: The figure dict-like or data list-like object that
+ |                        describes a plotly figure.
+ |                        Same argument used in `py.plot`, `py.iplot`,
+ |                        see https://plot.ly/python for examples
+ |      - filename: The filepath to save the image to
+ |      - format: 'png', 'svg', 'jpeg', 'pdf'
+ |      - width: output width
+ |      - height: output height
+ |      - scale: Increase the resolution of the image by `scale` amount
+ |             Only valid for PNG and JPEG images.
+ |      
+ |      example:
+ |      ```
+ |      import plotly.plotly as py
+ |      fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}
+ |      py.image.save_as(fig, 'my_image.png', scale=3)
+ |      ```
+ |  
+ |  ----------------------------------------------------------------------
+ |  Static methods defined here:
+ |  
+ |  get(figure_or_data, format='png', width=None, height=None, scale=None)
+ |      Return a static image of the plot described by `figure_or_data`.
+ |      
+ |      positional arguments:
+ |      - figure_or_data: The figure dict-like or data list-like object that
+ |                        describes a plotly figure.
+ |                        Same argument used in `py.plot`, `py.iplot`,
+ |                        see https://plot.ly/python for examples
+ |      - format: 'png', 'svg', 'jpeg', 'pdf'
+ |      - width: output width
+ |      - height: output height
+ |      - scale: Increase the resolution of the image by `scale`
+ |               amount (e.g. `3`)
+ |               Only valid for PNG and JPEG images.
+ |      
+ |      example:
+ |      ```
+ |      import plotly.plotly as py
+ |      fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}
+ |      py.image.get(fig, 'png', scale=3)
+ |      ```
+
+
+
+
+ +
+
+ +
+ + +{% endraw %} \ No newline at end of file diff --git a/_posts/matplotlib/static-image/2016-02-22-static-image_matplotlib_index.md b/_posts/matplotlib/static-image/2016-02-22-static-image_matplotlib_index.md deleted file mode 100644 index f891499c5914..000000000000 --- a/_posts/matplotlib/static-image/2016-02-22-static-image_matplotlib_index.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -name: Matplotlib Static Image Export -permalink: matplotlib/static-image-export/ -description: How to export plotly matplotlib graphs as static images in Python. Plotly supports png, svg, jpg, and pdf image export. -layout: getstart-base -thumbnail: thumbnail/png-export.png -language: matplotlib -page_type: example_index -has_thumbnail: true -display_as: basic -sitemap: false -order: 5 ---- -
-

You can save static images using the `save_as` method. This is similar to `save_fig` method available in matplotlib:


- -
# Import modules
-import plotly.plotly as py
-import plotly.tools as tls
-import matplotlib.pyplot as plt
-
-# Create a plot
-x = [1, 2]
-y = [2, 4]
-plt.plot(x, y)
-
-# Get Matplotlib Figure
-mpl_fig = plt.gcf() 
-
-# Convert to plotly figure
-plotly_fig = tls.mpl_to_plotly(mpl_fig) 
-
-# Save image
-py.image.save_as(plotly_fig, 'your_image_filename.png') 
-
- -In Addition, you can specify the size of the matplotlib/plotly figure to be saved by using following method: - -
import plotly.plotly as py
-py.image.save_as(plotly_fig, 'your_image_filename.png', height=desired_height, width=desired_width) 
-
- -

You can also display inline static images in IPython:


- -
import plotly.plotly as py
-py.image.ishow(plotly_fig)
-
- - -

You can view the static version of any Plotly graph by appending .png, -.pdf, .eps, or .svg to the end of the URL.


-

For example, view the static image of https://plot.ly/~chris/1638 at https://plot.ly/~chris/1638.png.


- -

Combine this with the requests package and download the latest version of your Plotly graph:


- - -
import requests
-
-image_bytes = requests.get('https://plot.ly/~chris/1638.png').content
-
-
- -

diff --git a/_posts/matplotlib/static-image/static-image.ipynb b/_posts/matplotlib/static-image/static-image.ipynb new file mode 100644 index 000000000000..baaf87ef94b8 --- /dev/null +++ b/_posts/matplotlib/static-image/static-image.ipynb @@ -0,0 +1,344 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### New to Plotly?\n", + "Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).\n", + "
You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).\n", + "
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Version Check\n", + "Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'3.1.1'" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly\n", + "plotly.__version__" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# Import modules\n", + "import plotly.plotly as py\n", + "import plotly.tools as tls\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Create a plot\n", + "x = [1, 2]\n", + "y = [2, 4]\n", + "plt.plot(x, y)\n", + "\n", + "# Get Matplotlib Figure\n", + "mpl_fig = plt.gcf() \n", + "\n", + "# Convert to plotly figure\n", + "plotly_fig = tls.mpl_to_plotly(mpl_fig) \n", + "\n", + "# Save image\n", + "py.image.save_as(plotly_fig, 'your_image_filename.png') " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In Addition, you can specify the size of the matplotlib/plotly figure to be saved by using following method:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "import plotly.plotly as py\n", + "py.image.save_as(plotly_fig, 'your_image_filename.png', height=desired_height, width=desired_width) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can also display inline static images in IPython:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbAAAAEgCAYAAADVKCZpAAAgAElEQVR4Xu2dCZhU1ZXHD4xsLgid\nqAgIikHEhTHoiEYWNco2ikFjxBhANlmadaCRtaFla/Z9EZBRIAIqI+oYMWCCJCoa48JmzKARGxpF\nggsIqEjPd+vapBua7uqq9959p97vfV9/ZoZ695zzO6fuv869t16VycvLyxMuCEAAAhCAgDICZRAw\nZRnDXQhAAAIQiBFAwCgECEAAAhBQSQABU5k2nIYABCAAAQSMGoAABCAAAZUEEDCVacNpCEAAAhBA\nwKgBCEAAAhBQSQABU5k2nIYABCAAAQSMGoAABCAAAZUEEDCVacNpCEAAAhBAwKgBCEAAAhBQSQAB\nU5k2nIYABCAAAQSMGoAABCAAAZUEEDCVacNpCEAAAhBAwKgBCEAAAhBQSQABU5k2nIYABCAAAQSM\nGoAABCAAAZUEEDCVacNpCEAAAhBAwKgBCEAAAhBQSQABU5k2nIYABCAAAQSMGoAABCAAAZUEEDCV\nacNpCEAAAhBAwKgBCEAAAhBQSQABU5k2nIYABCAAAfUCtmLFCtm2bZuMHTuWbEIAAhCAQIQIqBaw\njz76SJ588kn58ssvEbAIFS2hQgACEDAE1ArYsWPHJDMzU9LT02Xu3LkIGPUMAQhAIGIE1ArYqlWr\n5Pzzz5eGDRtKdnZ2IQG79dZbI5ZGwoUABCDgHYF169Z5N5iPI6kUsJycHHn88cflwQcflIMHDxYp\nYFoSkEhux4wZI82aNZOmTZsmcnvo7+natauMHDlSateuHXpfE3HQfMBK1frcuXOnmPpcvHhxImhC\nf8/GjR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fv36MQHjggAEIACB6BFQKWBbtmyRwYMHy/nnn388Y/fee2/s\n9CEXBCAAAQhEg4BKAYtGaogSAhCAAASKI6BewJ599ll58cUXY98HGzBggFx66aWF4n3ppZfkueee\nk7Jly8rll18uXbp0UV0Rhw4dknHjxslll10m9913n+pYjPOvvfaaTJw4UdasWXNSLPv375cFCxbI\n3r17xex5msM69erVUxVzcfHlB/LVV19Jt27dYl8FueSSS1TF99hjj8n27dtjOSzqeuedd2IPHTDv\nv7vuuktuuOEGNfGV9F7bsWOHzJs3T0477TSpVKmSDB06VCpWrKgmvoKOlvRwiLAGpVrAcnNzZerU\nqTJlyhT57LPPZPLkybG/glePHj1kzpw5sSIzj38x/3cN88uOCi/zBe4hQ4bEJvEKFSqoF7BXX31V\nNmzYIOarELNnzz4pI1988YUYEatTp07sNSa306ZNU5O5kuLLD8TEdfjwYWnXrp0qAVu4cGHsu5fm\noQIFv8aSH5fJ3fDhw2MfuNLS0tTkzTgaz3stKytLOnfuLBdccIE89dRTcvrpp0vr1q1VxZnvbEkP\nhwhrUKoFbO3atbE3ftu2bWN8MzIyYiJVuXLl47x79+4d+3Roisvsm5k3VJUqVcKajxL9OnjwoGzb\ntk3Mpz/tHZj5hGs+ufbr109mzZpVbOzfffed9OnTJ9aRabniic90aB988IGYvN58882qBMz4bD4Y\nZmZmFilgTz/9tJQrV05uu+02LSkr5GdJ7zXzwcMIllnZWbJkSeyDpaYOs7iknPhwiLAmULWAPf74\n41K9enW58cYbY3yzs7Njn2ILfifMPC/RfNH57LPPljvvvFMaN24c1lzE7demTZtik552AcsP2AhT\nUR1YQSDr16+X3bt3S8eOHePmFJYXnio+M0FOmDBBzCd5083ccsstqgTM8DUfIEeNGlWkgJluuVq1\narFaNUtUnTp1KvTeDEt+ivOjuPea6TDN91CrVq0qtWrVku7du2sIqUQfi3o4RIk3OXqBagF74okn\n5Nxzzy0kYPfcc49cdNFFx3GaN1HNmjVjSwJmqcNMFmb5TfMVNQEzwmWWis1krzF3pxIw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AAAhDwjsD/A1ijhq9u\nfj2uAAAAAElFTkSuQmCC\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import plotly.plotly as py\n", + "py.image.ishow(plotly_fig)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can view the static version of any Plotly graph by appending `.png`, `.pdf`, `.eps`, or `.svg` to the end of the URL. For example, view the static image of https://plot.ly/~chris/1638 at https://plot.ly/~chris/1638.png." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Combine this with the requests package and download the latest version of your Plotly graph:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "image_bytes = requests.get('https://plot.ly/~chris/1638.png').content" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Reference" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "See [https://plot.ly/python/static-image-export/](https://plot.ly/python/static-image-export/) for more information and chart attribute options!" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on class image in module plotly.plotly.plotly:\n", + "\n", + "class image\n", + " | Helper functions wrapped around plotly's static image generation api.\n", + " | \n", + " | Class methods defined here:\n", + " | \n", + " | ishow(cls, figure_or_data, format='png', width=None, height=None, scale=None) from __builtin__.classobj\n", + " | Display a static image of the plot described by `figure_or_data`\n", + " | in an IPython Notebook.\n", + " | \n", + " | positional arguments:\n", + " | - figure_or_data: The figure dict-like or data list-like object that\n", + " | describes a plotly figure.\n", + " | Same argument used in `py.plot`, `py.iplot`,\n", + " | see https://plot.ly/python for examples\n", + " | - format: 'png', 'svg', 'jpeg', 'pdf'\n", + " | - width: output width\n", + " | - height: output height\n", + " | - scale: Increase the resolution of the image by `scale` amount\n", + " | Only valid for PNG and JPEG images.\n", + " | \n", + " | example:\n", + " | ```\n", + " | import plotly.plotly as py\n", + " | fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}\n", + " | py.image.ishow(fig, 'png', scale=3)\n", + " | \n", + " | save_as(cls, figure_or_data, filename, format=None, width=None, height=None, scale=None) from __builtin__.classobj\n", + " | Save a image of the plot described by `figure_or_data` locally as\n", + " | `filename`.\n", + " | \n", + " | Valid image formats are 'png', 'svg', 'jpeg', and 'pdf'.\n", + " | The format is taken as the extension of the filename or as the\n", + " | supplied format.\n", + " | \n", + " | positional arguments:\n", + " | - figure_or_data: The figure dict-like or data list-like object that\n", + " | describes a plotly figure.\n", + " | Same argument used in `py.plot`, `py.iplot`,\n", + " | see https://plot.ly/python for examples\n", + " | - filename: The filepath to save the image to\n", + " | - format: 'png', 'svg', 'jpeg', 'pdf'\n", + " | - width: output width\n", + " | - height: output height\n", + " | - scale: Increase the resolution of the image by `scale` amount\n", + " | Only valid for PNG and JPEG images.\n", + " | \n", + " | example:\n", + " | ```\n", + " | import plotly.plotly as py\n", + " | fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}\n", + " | py.image.save_as(fig, 'my_image.png', scale=3)\n", + " | ```\n", + " | \n", + " | ----------------------------------------------------------------------\n", + " | Static methods defined here:\n", + " | \n", + " | get(figure_or_data, format='png', width=None, height=None, scale=None)\n", + " | Return a static image of the plot described by `figure_or_data`.\n", + " | \n", + " | positional arguments:\n", + " | - figure_or_data: The figure dict-like or data list-like object that\n", + " | describes a plotly figure.\n", + " | Same argument used in `py.plot`, `py.iplot`,\n", + " | see https://plot.ly/python for examples\n", + " | - format: 'png', 'svg', 'jpeg', 'pdf'\n", + " | - width: output width\n", + " | - height: output height\n", + " | - scale: Increase the resolution of the image by `scale`\n", + " | amount (e.g. `3`)\n", + " | Only valid for PNG and JPEG images.\n", + " | \n", + " | example:\n", + " | ```\n", + " | import plotly.plotly as py\n", + " | fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}\n", + " | py.image.get(fig, 'png', scale=3)\n", + " | ```\n", + "\n" + ] + } + ], + "source": [ + "help(py.image)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting git+https://github.com/plotly/publisher.git\n", + " Cloning https://github.com/plotly/publisher.git to c:\\users\\thars\\appdata\\local\\temp\\pip-req-build-vqazbm\n", + "Building wheels for collected packages: publisher\n", + " Running setup.py bdist_wheel for publisher: started\n", + " Running setup.py bdist_wheel for publisher: finished with status 'done'\n", + " Stored in directory: c:\\users\\thars\\appdata\\local\\temp\\pip-ephem-wheel-cache-23ha8h\\wheels\\99\\3e\\a0\\fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", + "Successfully built publisher\n", + "Installing collected packages: publisher\n", + " Found existing installation: publisher 0.11\n", + " Uninstalling publisher-0.11:\n", + " Successfully uninstalled publisher-0.11\n", + "Successfully installed publisher-0.11\n" + ] + } + ], + "source": [ + "from IPython.display import display, HTML\n", + "\n", + "display(HTML(''))\n", + "display(HTML(''))\n", + "\n", + "! pip install git+https://github.com/plotly/publisher.git --upgrade\n", + "import publisher\n", + "publisher.publish(\n", + " 'static-image.ipynb', 'matplotlib/static-image/', 'Matplotlib Static Image Export',\n", + " 'How to export plotly matplotlib graphs as static images in Python. Plotly supports png, svg, jpg, and pdf image export.',\n", + " title = 'Matplotlib Static Image Export | Plotly',\n", + " has_thumbnail='true', \n", + " thumbnail='thumbnail/png-export.png', \n", + " language='matplotlib', \n", + " page_type='example_index',\n", + " display_as='basic', order=5,\n", + " ipynb='~notebook_demo/232')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.14" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}