From c7ff155bbd038ae682fd84409be65f40d7cfaa22 Mon Sep 17 00:00:00 2001 From: Kully Date: Tue, 20 Jun 2017 14:23:12 -0400 Subject: [PATCH 1/5] facet python doc --- .../2015-06-30-facet-and-trellis-plots.html | 804 ++++++++++++++++++ .../facet-and-trellis-plots.ipynb | 762 +++++++++++++++++ 2 files changed, 1566 insertions(+) create mode 100644 _posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html create mode 100644 _posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb diff --git a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html new file mode 100644 index 000000000000..a3653527e0e5 --- /dev/null +++ b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html @@ -0,0 +1,804 @@ +--- +permalink: python/facet-trellis/ +description: How to make Facet and Trellis Plots in Python with Plotly. +name: Facet and Trellis Plots | plotly +has_thumbnail: true +thumbnail: thumbnail/facet-trellis-thumbnail.jpg +layout: user-guide +name: Facet and Trellis Plots +language: python +title: Python Facet and Trellis Plots | plotly +display_as: statistical +has_thumbnail: true +page_type: u-guide +order: 10.2 +--- +{% 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¶

Note: Facet Grids and Trellis Plots are available in version 2.0.10+
+Run pip install plotly --upgrade to update your Plotly version

+ +
+
+
+
+
+
In [1]:
+
+
+
import plotly
+plotly.__version__
+
+ +
+
+
+ +
+
+ + +
+ +
Out[1]:
+ + + + +
+
'2.0.10'
+
+ +
+ +
+
+ +
+
+
+
+
+

Import Data¶

Let us first import some userful datasets for our facet and trellis plots.

+ +
+
+
+
+
+
In [2]:
+
+
+
import pandas as pd
+
+mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
+tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
+
+ +
+
+
+ +
+
+
+
+
+

Facet by Column¶

+
+
+
+
+
+
In [3]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+grid = ff.create_facet_grid(
+    mpg,
+    x='displ',
+    y='cty',
+    facet_col='cyl',
+)
+
+py.iplot(grid, filename='facet by col')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[3]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Facet by Row¶

+
+
+
+
+
+
In [4]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+grid = ff.create_facet_grid(
+    mpg,
+    x='displ',
+    y='cty',
+    facet_row='cyl',
+)
+
+py.iplot(grid, filename='facet by row')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[4]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Facet by Row and Column¶

+
+
+
+
+
+
In [5]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+grid = ff.create_facet_grid(
+    mpg,
+    x='displ',
+    y='cty',
+    facet_row='cyl',
+    facet_col='drv'
+)
+
+py.iplot(grid, filename='facet by row and col')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[5]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Color by Categorical Variable¶

+
+
+
+
+
+
In [6]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    mtcars,
+    x='mpg',
+    y='wt',
+    facet_col='cyl',
+    color_name='cyl',
+    color_is_cat=True,
+)
+py.iplot(fig, filename='facet - color by categorical variable')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[6]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Color by Continuous Variable¶

+
+
+
+
+
+
In [7]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    tips,
+    x='total_bill',
+    y='tip',
+    facet_row='sex',
+    facet_col='smoker',
+    color_name='size',
+    colormap='Viridis',
+    show_boxes=False,
+    marker={'size': 12, 'symbol': 'star-diamond'},
+)
+py.iplot(fig, filename='facet - color by continuous variable')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[7]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Label Variable Name and Value¶

+
+
+
+
+
+
In [8]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    mtcars,
+    x='mpg',
+    y='wt',
+    facet_col='cyl',
+    facet_col_labels='name',
+    facet_row_labels='name',
+)
+py.iplot(fig, filename='facet - label variable name')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[8]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Custom Labels¶

+
+
+
+
+
+
In [9]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    mtcars,
+    x='wt',
+    y='mpg',
+    facet_col='cyl',
+    facet_col_labels={4: "$\\alpha$", 6: '$\\beta$', 8: '$\sqrt[y]{x}$'},
+)
+
+py.iplot(fig, filename='facet - custom labels')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[9]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Plot in 'ggplot2' style¶

To learn more about ggplot2, check out http://ggplot2.tidyverse.org/reference/facet_grid.html

+ +
+
+
+
+
+
In [10]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    tips,
+    x='total_bill',
+    y='tip',
+    facet_row='sex',
+    facet_col='smoker',
+    marker={'symbol': 'circle-open', 'size': 10},
+    ggplot2=True
+)
+py.iplot(fig, filename='facet - ggplot2 style')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[10]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Plot with 'scattergl' traces¶

+
+
+
+
+
+
In [11]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+grid = ff.create_facet_grid(
+    mpg,
+    x='class',
+    y='displ',
+    trace_type='scattergl',
+)
+
+py.iplot(grid, filename='facet - scattergl')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[11]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Plot with Histogram Traces¶

Native Histogram Trace Types Coming Soon!

+ +
+
+
+
+
+
In [12]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+fig = ff.create_facet_grid(
+    tips,
+    x='total_bill',
+    y='tip',
+    facet_row='sex',
+    facet_col='smoker',
+)
+
+for trace in fig['data']:
+    trace['type'] = 'histogram'
+    del trace['marker']['size']
+    del trace['mode']
+
+py.iplot(fig, filename='facet - bar traces')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[12]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Reference¶

+
+
+
+
+
+
In [13]:
+
+
+
help(ff.create_facet_grid)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Help on function create_facet_grid in module plotly.figure_factory._facet_grid:
+
+create_facet_grid(df, x, y, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)
+    Returns figure for facet grid.
+    
+    :param (pd.DataFrame) df: the dataframe of columns for the facet grid.
+    :param (str) x: the name of the dataframe column for the x axis data.
+    :param (str) y: the name of the dataframe column for the y axis data.
+    :param (str) facet_row: the name of the dataframe column that is used to
+        facet the grid into row panels.
+    :param (str) facet_col: the name of the dataframe column that is used to
+        facet the grid into column panels.
+    :param (str) color_name: the name of your dataframe column that will
+        function as the colormap variable.
+    :param (str|list|dict) colormap: the param that determines how the
+        color_name column colors the data. If the dataframe contains numeric
+        data, then a dictionary of colors will group the data categorically
+        while a Plotly Colorscale name or a custom colorscale will treat it
+        numerically. To learn more about colors and types of colormap, run
+        `help(plotly.colors)`.
+    :param (bool) color_is_cat: determines whether a numerical column for the
+        colormap will be treated as categorical (True) or sequential (False).
+            Default = False.
+    :param (str|dict) facet_row_labels: set to either 'name' or a dictionary
+        of all the unique values in the faceting row mapped to some text to
+        show up in the label annotations. If None, labeling works like usual.
+    :param (str|dict) facet_col_labels: set to either 'name' or a dictionary
+        of all the values in the faceting row mapped to some text to show up
+        in the label annotations. If None, labeling works like usual.
+    :param (int) height: the height of the facet grid figure.
+    :param (int) width: the width of the facet grid figure.
+    :param (str) trace_type: decides the type of plot to appear in the
+        facet grid. The options are 'scatter' and 'scattergl'.
+        Default = 'scatter'.
+    :param (str) scales: determines if axes have fixed ranges or not. Valid
+        settings are 'fixed' (all axes fixed), 'free_x' (x axis free only),
+        'free_y' (y axis free only) or 'free' (both axes free).
+    :param (float) dtick_x: determines the distance between each tick on the
+        x-axis. Default is None which means dtick_x is set automatically.
+    :param (float) dtick_y: determines the distance between each tick on the
+        y-axis. Default is None which means dtick_y is set automatically.
+    :param (bool) show_boxes: draws grey boxes behind the facet titles.
+    :param (bool) ggplot2: draws the facet grid in the style of `ggplot2`. See
+        http://ggplot2.tidyverse.org/reference/facet_grid.html for reference.
+        Default = False
+    :param (int) binsize: groups all data into bins of a given length.
+    :param (dict) kwargs: a dictionary of scatterplot arguments.
+    
+    Examples 1: One Way Faceting
+    ```
+    import plotly.plotly as py
+    import plotly.figure_factory as ff
+    
+    import pandas as pd
+    
+    mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+    
+    fig = ff.create_facet_grid(
+        mpg,
+        x='displ',
+        y='cty',
+        facet_col='cyl',
+    )
+    
+    py.iplot(fig, filename='facet_grid_mpg_one_way_facet')
+    ```
+    
+    Example 2: Two Way Faceting
+    ```
+    import plotly.plotly as py
+    import plotly.figure_factory as ff
+    
+    import pandas as pd
+    
+    mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+    
+    fig = ff.create_facet_grid(
+        mpg,
+        x='displ',
+        y='cty',
+        facet_row='drv',
+        facet_col='cyl',
+    )
+    
+    py.iplot(fig, filename='facet_grid_mpg_two_way_facet')
+    ```
+    
+    Example 3: Categorical Coloring
+    ```
+    import plotly.plotly as py
+    import plotly.figure_factory as ff
+    
+    import pandas as pd
+    
+    mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+    
+    fig = ff.create_facet_grid(
+        mtcars,
+        x='mpg',
+        y='wt',
+        facet_col='cyl',
+        color_name='cyl',
+        color_is_cat=True,
+    )
+    py.iplot(fig, filename='facet_grid_mpg_default_colors')
+    ```
+    
+    Example 4: Sequential Coloring
+    ```
+    import plotly.plotly as py
+    import plotly.figure_factory as ff
+    
+    import pandas as pd
+    
+    tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
+    
+    fig = ff.create_facet_grid(
+        tips,
+        x='total_bill',
+        y='tip',
+        facet_row='sex',
+        facet_col='smoker',
+        color_name='size',
+        colormap='Viridis',
+    )
+    py.iplot(fig, filename='facet_grid_tips_sequential_colors')
+    ```
+    
+    Example 5: Custom labels
+    ```
+    import plotly.plotly as py
+    import plotly.figure_factory as ff
+    
+    import pandas as pd
+    
+    mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
+    
+    fig = ff.create_facet_grid(
+        mtcars,
+        x='wt',
+        y='mpg',
+        facet_col='cyl',
+        facet_col_labels={4: "$\alpha$", 6: '$\beta$', 8: '$\sqrt[y]{x}$'},
+    )
+    
+    py.iplot(fig, filename='facet_grid_mtcars_custom_labels')
+    ```
+
+
+
+
+ +
+
+ +
+ + +{% endraw %} \ No newline at end of file diff --git a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb new file mode 100644 index 000000000000..999b7937296f --- /dev/null +++ b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb @@ -0,0 +1,762 @@ +{ + "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", + "Note: `Facet Grids and Trellis Plots` are available in version 2.0.10+
\n", + "Run `pip install plotly --upgrade` to update your Plotly version" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'2.0.10'" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly\n", + "plotly.__version__" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Import Data\n", + "Let us first import some userful datasets for our facet and trellis plots." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "\n", + "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n", + "mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n", + "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Facet by Column" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "grid = ff.create_facet_grid(\n", + " mpg,\n", + " x='displ',\n", + " y='cty',\n", + " facet_col='cyl',\n", + ")\n", + "\n", + "py.iplot(grid, filename='facet by col')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Facet by Row" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "grid = ff.create_facet_grid(\n", + " mpg,\n", + " x='displ',\n", + " y='cty',\n", + " facet_row='cyl',\n", + ")\n", + "\n", + "py.iplot(grid, filename='facet by row')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Facet by Row and Column" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "grid = ff.create_facet_grid(\n", + " mpg,\n", + " x='displ',\n", + " y='cty',\n", + " facet_row='cyl',\n", + " facet_col='drv'\n", + ")\n", + "\n", + "py.iplot(grid, filename='facet by row and col')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Color by Categorical Variable" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='mpg',\n", + " y='wt',\n", + " facet_col='cyl',\n", + " color_name='cyl',\n", + " color_is_cat=True,\n", + ")\n", + "py.iplot(fig, filename='facet - color by categorical variable')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Color by Continuous Variable" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " tips,\n", + " x='total_bill',\n", + " y='tip',\n", + " facet_row='sex',\n", + " facet_col='smoker',\n", + " color_name='size',\n", + " colormap='Viridis',\n", + " show_boxes=False,\n", + " marker={'size': 12, 'symbol': 'star-diamond'},\n", + ")\n", + "py.iplot(fig, filename='facet - color by continuous variable')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Label Variable Name and Value" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='mpg',\n", + " y='wt',\n", + " facet_col='cyl',\n", + " facet_col_labels='name',\n", + " facet_row_labels='name',\n", + ")\n", + "py.iplot(fig, filename='facet - label variable name')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Custom Labels" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='wt',\n", + " y='mpg',\n", + " facet_col='cyl',\n", + " facet_col_labels={4: \"$\\\\alpha$\", 6: '$\\\\beta$', 8: '$\\sqrt[y]{x}$'},\n", + ")\n", + "\n", + "py.iplot(fig, filename='facet - custom labels')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plot in 'ggplot2' style\n", + "To learn more about ggplot2, check out http://ggplot2.tidyverse.org/reference/facet_grid.html" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " tips,\n", + " x='total_bill',\n", + " y='tip',\n", + " facet_row='sex',\n", + " facet_col='smoker',\n", + " marker={'symbol': 'circle-open', 'size': 10},\n", + " ggplot2=True\n", + ")\n", + "py.iplot(fig, filename='facet - ggplot2 style')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plot with 'scattergl' traces" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "grid = ff.create_facet_grid(\n", + " mpg,\n", + " x='class',\n", + " y='displ',\n", + " trace_type='scattergl',\n", + ")\n", + "\n", + "py.iplot(grid, filename='facet - scattergl')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plot with Histogram Traces\n", + "Native Histogram Trace Types Coming Soon!" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "fig = ff.create_facet_grid(\n", + " tips,\n", + " x='total_bill',\n", + " y='tip',\n", + " facet_row='sex',\n", + " facet_col='smoker',\n", + ")\n", + "\n", + "for trace in fig['data']:\n", + " trace['type'] = 'histogram'\n", + " del trace['marker']['size']\n", + " del trace['mode']\n", + "\n", + "py.iplot(fig, filename='facet - bar traces')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Reference" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on function create_facet_grid in module plotly.figure_factory._facet_grid:\n", + "\n", + "create_facet_grid(df, x, y, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)\n", + " Returns figure for facet grid.\n", + " \n", + " :param (pd.DataFrame) df: the dataframe of columns for the facet grid.\n", + " :param (str) x: the name of the dataframe column for the x axis data.\n", + " :param (str) y: the name of the dataframe column for the y axis data.\n", + " :param (str) facet_row: the name of the dataframe column that is used to\n", + " facet the grid into row panels.\n", + " :param (str) facet_col: the name of the dataframe column that is used to\n", + " facet the grid into column panels.\n", + " :param (str) color_name: the name of your dataframe column that will\n", + " function as the colormap variable.\n", + " :param (str|list|dict) colormap: the param that determines how the\n", + " color_name column colors the data. If the dataframe contains numeric\n", + " data, then a dictionary of colors will group the data categorically\n", + " while a Plotly Colorscale name or a custom colorscale will treat it\n", + " numerically. To learn more about colors and types of colormap, run\n", + " `help(plotly.colors)`.\n", + " :param (bool) color_is_cat: determines whether a numerical column for the\n", + " colormap will be treated as categorical (True) or sequential (False).\n", + " Default = False.\n", + " :param (str|dict) facet_row_labels: set to either 'name' or a dictionary\n", + " of all the unique values in the faceting row mapped to some text to\n", + " show up in the label annotations. If None, labeling works like usual.\n", + " :param (str|dict) facet_col_labels: set to either 'name' or a dictionary\n", + " of all the values in the faceting row mapped to some text to show up\n", + " in the label annotations. If None, labeling works like usual.\n", + " :param (int) height: the height of the facet grid figure.\n", + " :param (int) width: the width of the facet grid figure.\n", + " :param (str) trace_type: decides the type of plot to appear in the\n", + " facet grid. The options are 'scatter' and 'scattergl'.\n", + " Default = 'scatter'.\n", + " :param (str) scales: determines if axes have fixed ranges or not. Valid\n", + " settings are 'fixed' (all axes fixed), 'free_x' (x axis free only),\n", + " 'free_y' (y axis free only) or 'free' (both axes free).\n", + " :param (float) dtick_x: determines the distance between each tick on the\n", + " x-axis. Default is None which means dtick_x is set automatically.\n", + " :param (float) dtick_y: determines the distance between each tick on the\n", + " y-axis. Default is None which means dtick_y is set automatically.\n", + " :param (bool) show_boxes: draws grey boxes behind the facet titles.\n", + " :param (bool) ggplot2: draws the facet grid in the style of `ggplot2`. See\n", + " http://ggplot2.tidyverse.org/reference/facet_grid.html for reference.\n", + " Default = False\n", + " :param (int) binsize: groups all data into bins of a given length.\n", + " :param (dict) kwargs: a dictionary of scatterplot arguments.\n", + " \n", + " Examples 1: One Way Faceting\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " mpg,\n", + " x='displ',\n", + " y='cty',\n", + " facet_col='cyl',\n", + " )\n", + " \n", + " py.iplot(fig, filename='facet_grid_mpg_one_way_facet')\n", + " ```\n", + " \n", + " Example 2: Two Way Faceting\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " mpg,\n", + " x='displ',\n", + " y='cty',\n", + " facet_row='drv',\n", + " facet_col='cyl',\n", + " )\n", + " \n", + " py.iplot(fig, filename='facet_grid_mpg_two_way_facet')\n", + " ```\n", + " \n", + " Example 3: Categorical Coloring\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='mpg',\n", + " y='wt',\n", + " facet_col='cyl',\n", + " color_name='cyl',\n", + " color_is_cat=True,\n", + " )\n", + " py.iplot(fig, filename='facet_grid_mpg_default_colors')\n", + " ```\n", + " \n", + " Example 4: Sequential Coloring\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " tips,\n", + " x='total_bill',\n", + " y='tip',\n", + " facet_row='sex',\n", + " facet_col='smoker',\n", + " color_name='size',\n", + " colormap='Viridis',\n", + " )\n", + " py.iplot(fig, filename='facet_grid_tips_sequential_colors')\n", + " ```\n", + " \n", + " Example 5: Custom labels\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='wt',\n", + " y='mpg',\n", + " facet_col='cyl',\n", + " facet_col_labels={4: \"$\\alpha$\", 6: '$\\beta$', 8: '$\\sqrt[y]{x}$'},\n", + " )\n", + " \n", + " py.iplot(fig, filename='facet_grid_mtcars_custom_labels')\n", + " ```\n", + "\n" + ] + } + ], + "source": [ + "help(ff.create_facet_grid)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "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 /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-qFTn3c-build\n", + "Installing collected packages: publisher\n", + " Found existing installation: publisher 0.10\n", + " Uninstalling publisher-0.10:\n", + " Successfully uninstalled publisher-0.10\n", + " Running setup.py install for publisher ... \u001b[?25ldone\n", + "\u001b[?25hSuccessfully installed publisher-0.10\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/nbconvert.py:13: ShimWarning:\n", + "\n", + "The `IPython.nbconvert` package has been deprecated since IPython 4.0. You should import from nbconvert instead.\n", + "\n", + "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/publisher/publisher.py:53: UserWarning:\n", + "\n", + "Did you \"Save\" this notebook before running this command? Remember to save, always save.\n", + "\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", + " 'facet-and-trellis-plots.ipynb', 'python/facet-trellis/', 'Facet and Trellis Plots | plotly',\n", + " 'How to make Facet and Trellis Plots in Python with Plotly.',\n", + " title = 'Python Facet and Trellis Plots | plotly',\n", + " name = 'Facet and Trellis Plots',\n", + " has_thumbnail='true', thumbnail='thumbnail/facet-trellis-thumbnail.jpg',\n", + " language='python', display_as='statistical', order=10.2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} From ecae5e6b933b34660ce8a3da47cf2c92faf223b8 Mon Sep 17 00:00:00 2001 From: Kully Date: Tue, 20 Jun 2017 16:37:49 -0400 Subject: [PATCH 2/5] self contained examples --- .../2015-06-30-facet-and-trellis-plots.html | 90 +++++++++--------- .../facet-and-trellis-plots.ipynb | 91 ++++++++++--------- 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html index a3653527e0e5..8c6d82762b5f 100644 --- a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html +++ b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html @@ -68,32 +68,6 @@

Version Check - -
-
-
-
-

Import Data¶

Let us first import some userful datasets for our facet and trellis plots.

- -
-
-
-
-
-
In [2]:
-
-
-
import pandas as pd
-
-mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
-mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
-tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
-
- -
-
-
-
@@ -111,6 +85,9 @@

Facet by Column
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+
 grid = ff.create_facet_grid(
     mpg,
     x='displ',
@@ -161,6 +138,9 @@ 

Facet by Row&#
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+
 grid = ff.create_facet_grid(
     mpg,
     x='displ',
@@ -205,12 +185,15 @@ 

Facet by Row and Column
-
In [5]:
+
In [6]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+
 grid = ff.create_facet_grid(
     mpg,
     x='displ',
@@ -232,7 +215,7 @@ 

Facet by Row and Column -
Out[5]:
+
Out[6]:
@@ -256,12 +239,15 @@

Color by Categorical Variable
-
In [6]:
+
In [7]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
+
 fig = ff.create_facet_grid(
     mtcars,
     x='mpg',
@@ -283,7 +269,7 @@ 

Color by Categorical Variable -
Out[6]:
+
Out[7]:
@@ -307,12 +293,15 @@

Color by Continuous Variable
-
In [7]:
+
In [8]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
+
 fig = ff.create_facet_grid(
     tips,
     x='total_bill',
@@ -337,7 +326,7 @@ 

Color by Continuous Variable -
Out[7]:
+
Out[8]:
@@ -361,12 +350,15 @@

Label Variable Name and Value
-
In [8]:
+
In [9]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
+
 fig = ff.create_facet_grid(
     mtcars,
     x='mpg',
@@ -388,7 +380,7 @@ 

Label Variable Name and Value -
Out[8]:
+
Out[9]:
@@ -412,12 +404,15 @@

Custom Labels
-
In [9]:
+
In [10]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')
+
 fig = ff.create_facet_grid(
     mtcars,
     x='wt',
@@ -439,7 +434,7 @@ 

Custom Labels -
Out[9]:
+
Out[10]:
@@ -464,12 +459,15 @@

Plot in 'ggplot2' style
-
In [10]:
+
In [11]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
+
 fig = ff.create_facet_grid(
     tips,
     x='total_bill',
@@ -492,7 +490,7 @@ 

Plot in 'ggplot2' style -
Out[10]:
+
Out[11]:
@@ -516,12 +514,15 @@

Plot with 'scattergl' traces
-
In [11]:
+
In [12]:
import plotly.plotly as py
 import plotly.figure_factory as ff
 
+import pandas as pd
+mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
+
 grid = ff.create_facet_grid(
     mpg,
     x='class',
@@ -542,7 +543,7 @@ 

Plot with 'scattergl' traces -
Out[11]:
+
Out[12]:
@@ -567,12 +568,15 @@

Plot with Histogram Traces
-
In [12]:
+
In [13]:
-
In [13]:
+
In [14]:
help(ff.create_facet_grid)
diff --git a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
index 999b7937296f..ac096a3342b3 100644
--- a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
+++ b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
@@ -40,29 +40,6 @@
     "plotly.__version__"
    ]
   },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "#### Import Data\n",
-    "Let us first import some userful datasets for our facet and trellis plots."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {
-    "collapsed": true
-   },
-   "outputs": [],
-   "source": [
-    "import pandas as pd\n",
-    "\n",
-    "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n",
-    "mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n",
-    "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')"
-   ]
-  },
   {
    "cell_type": "markdown",
    "metadata": {},
@@ -93,6 +70,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n",
+    "\n",
     "grid = ff.create_facet_grid(\n",
     "    mpg,\n",
     "    x='displ',\n",
@@ -133,6 +113,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n",
+    "\n",
     "grid = ff.create_facet_grid(\n",
     "    mpg,\n",
     "    x='displ',\n",
@@ -152,7 +135,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 6,
    "metadata": {},
    "outputs": [
     {
@@ -164,7 +147,7 @@
        ""
       ]
      },
-     "execution_count": 5,
+     "execution_count": 6,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -173,6 +156,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n",
+    "\n",
     "grid = ff.create_facet_grid(\n",
     "    mpg,\n",
     "    x='displ',\n",
@@ -193,7 +179,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [
     {
@@ -205,7 +191,7 @@
        ""
       ]
      },
-     "execution_count": 6,
+     "execution_count": 7,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -214,6 +200,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    mtcars,\n",
     "    x='mpg',\n",
@@ -234,7 +223,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [
     {
@@ -246,7 +235,7 @@
        ""
       ]
      },
-     "execution_count": 7,
+     "execution_count": 8,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -255,6 +244,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    tips,\n",
     "    x='total_bill',\n",
@@ -278,7 +270,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [
     {
@@ -290,7 +282,7 @@
        ""
       ]
      },
-     "execution_count": 8,
+     "execution_count": 9,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -299,6 +291,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    mtcars,\n",
     "    x='mpg',\n",
@@ -319,7 +314,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [
     {
@@ -331,7 +326,7 @@
        ""
       ]
      },
-     "execution_count": 9,
+     "execution_count": 10,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -340,6 +335,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    mtcars,\n",
     "    x='wt',\n",
@@ -361,7 +359,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": 11,
    "metadata": {},
    "outputs": [
     {
@@ -373,7 +371,7 @@
        ""
       ]
      },
-     "execution_count": 10,
+     "execution_count": 11,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -382,6 +380,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    tips,\n",
     "    x='total_bill',\n",
@@ -403,7 +404,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": 12,
    "metadata": {},
    "outputs": [
     {
@@ -415,7 +416,7 @@
        ""
       ]
      },
-     "execution_count": 11,
+     "execution_count": 12,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -424,6 +425,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')\n",
+    "\n",
     "grid = ff.create_facet_grid(\n",
     "    mpg,\n",
     "    x='class',\n",
@@ -444,7 +448,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 13,
    "metadata": {},
    "outputs": [
     {
@@ -456,7 +460,7 @@
        ""
       ]
      },
-     "execution_count": 12,
+     "execution_count": 13,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -465,6 +469,9 @@
     "import plotly.plotly as py\n",
     "import plotly.figure_factory as ff\n",
     "\n",
+    "import pandas as pd\n",
+    "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')\n",
+    "\n",
     "fig = ff.create_facet_grid(\n",
     "    tips,\n",
     "    x='total_bill',\n",
@@ -490,7 +497,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 14,
    "metadata": {},
    "outputs": [
     {
@@ -654,7 +661,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 15,
    "metadata": {},
    "outputs": [
     {
@@ -686,7 +693,7 @@
      "output_type": "stream",
      "text": [
       "Collecting git+https://github.com/plotly/publisher.git\n",
-      "  Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-qFTn3c-build\n",
+      "  Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-oaUMZq-build\n",
       "Installing collected packages: publisher\n",
       "  Found existing installation: publisher 0.10\n",
       "    Uninstalling publisher-0.10:\n",

From 7e51712907093a96103041e886db5158c74100cb Mon Sep 17 00:00:00 2001
From: Kully 
Date: Mon, 3 Jul 2017 09:34:51 -0400
Subject: [PATCH 3/5] updated docs

---
 .../2015-06-30-facet-and-trellis-plots.html   | 176 ++++++++++++------
 .../facet-and-trellis-plots.ipynb             | 170 +++++++++++------
 2 files changed, 238 insertions(+), 108 deletions(-)

diff --git a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
index 8c6d82762b5f..1cb2d0d3a716 100644
--- a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
+++ b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
@@ -60,7 +60,7 @@ 

Version Check -
'2.0.10'
+
'2.0.12'

@@ -73,13 +73,14 @@

Version Check
-

Facet by Column¶

+

Facet by Column¶

A facet grid is a generalization of a scatterplot matrix where we can "facet" a row and/or column by another variable. Given some tabular data, stored in a pandas.DataFrame, we can plot one variable against another to form a regular scatter plot, and we can pick a third faceting variable to form panels along the rows and/or columns to segment the data even further, forming a bunch of panels. We can also assign a coloring rule or a heatmap based on a color variable to color the plot.

+

-
In [3]:
+
In [2]:
import plotly.plotly as py
@@ -108,12 +109,12 @@ 

Facet by Column -
Out[3]:
+
Out[2]:
- +

@@ -132,7 +133,7 @@

Facet by Row&#

-
In [4]:
+
In [3]:
import plotly.plotly as py
@@ -146,6 +147,7 @@ 

Facet by Row&# x='displ', y='cty', facet_row='cyl', + marker={'color': 'rgb(86, 7, 100)'}, ) py.iplot(grid, filename='facet by row') @@ -161,12 +163,12 @@

Facet by Row&#
-
Out[4]:
+
Out[3]:
- +
@@ -185,7 +187,7 @@

Facet by Row and Column
-
In [6]:
+
In [4]:
@@ -239,7 +242,7 @@

Color by Categorical Variable
-
In [7]:
+
In [5]:
-
In [9]:
+
In [7]:
import plotly.plotly as py
@@ -380,12 +381,12 @@ 

Label Variable Name and Value -
Out[9]:
+
Out[7]:
- +

@@ -404,7 +405,7 @@

Custom Labels
-
In [10]:
+
In [8]:
@@ -459,7 +461,7 @@

Plot in 'ggplot2' style
-
In [11]:
+
In [9]:
@@ -514,7 +516,7 @@

Plot with 'scattergl' traces
-
In [12]:
+
In [10]:
+
+
+
+
+

Other Trace Types¶

Facet Grids support scatter, scattergl, histogram, bar and box trace types. More trace types coming in the future.

+ +
+
+
+
+
+
In [17]:
+
+
+
import plotly.plotly as py
+import plotly.figure_factory as ff
+
+import pandas as pd
+tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
 
-py.iplot(fig, filename='facet - bar traces')
+fig = ff.create_facet_grid(
+    tips,
+    y='tip',
+    facet_row='sex',
+    facet_col='smoker',
+    trace_type='box',
+)
+
+py.iplot(fig, filename='facet - box traces')
 
@@ -603,12 +655,12 @@

Plot with Histogram Traces -
Out[13]:
+
Out[17]:
- +

@@ -627,7 +679,7 @@

Reference¶

-
In [14]:
+
In [18]:
help(ff.create_facet_grid)
@@ -649,7 +701,7 @@ 

Reference¶
Help on function create_facet_grid in module plotly.figure_factory._facet_grid:
 
-create_facet_grid(df, x, y, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)
+create_facet_grid(df, x=None, y=None, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)
     Returns figure for facet grid.
     
     :param (pd.DataFrame) df: the dataframe of columns for the facet grid.
@@ -679,7 +731,8 @@ 

Reference¶ :param (int) height: the height of the facet grid figure. :param (int) width: the width of the facet grid figure. :param (str) trace_type: decides the type of plot to appear in the - facet grid. The options are 'scatter' and 'scattergl'. + facet grid. The options are 'scatter', 'scattergl', 'histogram', + 'bar', and 'box'. Default = 'scatter'. :param (str) scales: determines if axes have fixed ranges or not. Valid settings are 'fixed' (all axes fixed), 'free_x' (x axis free only), @@ -710,7 +763,6 @@

Reference¶ y='cty', facet_col='cyl', ) - py.iplot(fig, filename='facet_grid_mpg_one_way_facet') ``` @@ -730,7 +782,6 @@

Reference¶ facet_row='drv', facet_col='cyl', ) - py.iplot(fig, filename='facet_grid_mpg_two_way_facet') ``` @@ -794,6 +845,25 @@

Reference¶ py.iplot(fig, filename='facet_grid_mtcars_custom_labels') ``` + + Example 6: Other Trace Type + ``` + import plotly.plotly as py + import plotly.figure_factory as ff + + import pandas as pd + + mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv') + + fig = ff.create_facet_grid( + mtcars, + x='wt', + facet_col='cyl', + trace_type='histogram', + ) + + py.iplot(fig, filename='facet_grid_mtcars_other_trace_type') + ```

diff --git a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb index ac096a3342b3..94478ed4c790 100644 --- a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb +++ b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb @@ -27,7 +27,7 @@ { "data": { "text/plain": [ - "'2.0.10'" + "'2.0.12'" ] }, "execution_count": 1, @@ -44,24 +44,25 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Facet by Column" + "#### Facet by Column\n", + "A `facet grid` is a generalization of a scatterplot matrix where we can \"facet\" a row and/or column by another variable. Given some tabular data, stored in a `pandas.DataFrame`, we can plot one variable against another to form a regular scatter plot, _and_ we can pick a third faceting variable to form panels along the rows and/or columns to segment the data even further, forming a bunch of panels. We can also assign a coloring rule or a heatmap based on a color variable to color the plot." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -92,19 +93,19 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -121,6 +122,7 @@ " x='displ',\n", " y='cty',\n", " facet_row='cyl',\n", + " marker={'color': 'rgb(86, 7, 100)'},\n", ")\n", "\n", "py.iplot(grid, filename='facet by row')" @@ -135,19 +137,19 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 6, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -164,7 +166,8 @@ " x='displ',\n", " y='cty',\n", " facet_row='cyl',\n", - " facet_col='drv'\n", + " facet_col='drv',\n", + " marker={'color': 'rgb(234, 239, 155)'},\n", ")\n", "\n", "py.iplot(grid, filename='facet by row and col')" @@ -179,19 +182,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -218,24 +221,24 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Color by Continuous Variable" + "#### Custom Colormap" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 8, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -251,38 +254,36 @@ " tips,\n", " x='total_bill',\n", " y='tip',\n", - " facet_row='sex',\n", - " facet_col='smoker',\n", - " color_name='size',\n", - " colormap='Viridis',\n", + " color_name='sex',\n", " show_boxes=False,\n", - " marker={'size': 12, 'symbol': 'star-diamond'},\n", + " marker={'size': 10, 'opacity': 1.0},\n", + " colormap={'Male': 'rgb(165, 242, 242)', 'Female': 'rgb(253, 174, 216)'}\n", ")\n", - "py.iplot(fig, filename='facet - color by continuous variable')" + "py.iplot(fig, filename='facet - custom colormap')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "#### Label Variable Name and Value" + "#### Label Variable Name:Value" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 9, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -314,19 +315,19 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 10, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -344,6 +345,7 @@ " y='mpg',\n", " facet_col='cyl',\n", " facet_col_labels={4: \"$\\\\alpha$\", 6: '$\\\\beta$', 8: '$\\sqrt[y]{x}$'},\n", + " marker={'color': 'rgb(240, 100, 2)'},\n", ")\n", "\n", "py.iplot(fig, filename='facet - custom labels')" @@ -359,19 +361,19 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 11, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -404,19 +406,19 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 12, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -442,25 +444,24 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Plot with Histogram Traces\n", - "Native Histogram Trace Types Coming Soon!" + "#### Plot with Histogram Traces" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 13, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -478,14 +479,55 @@ " y='tip',\n", " facet_row='sex',\n", " facet_col='smoker',\n", + " trace_type='histogram',\n", ")\n", "\n", - "for trace in fig['data']:\n", - " trace['type'] = 'histogram'\n", - " del trace['marker']['size']\n", - " del trace['mode']\n", + "py.iplot(fig, filename='facet - histogram traces')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Other Trace Types\n", + "Facet Grids support `scatter`, `scattergl`, `histogram`, `bar` and `box` trace types. More trace types coming in the future." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.figure_factory as ff\n", + "\n", + "import pandas as pd\n", + "tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')\n", + "\n", + "fig = ff.create_facet_grid(\n", + " tips,\n", + " y='tip',\n", + " facet_row='sex',\n", + " facet_col='smoker',\n", + " trace_type='box',\n", + ")\n", "\n", - "py.iplot(fig, filename='facet - bar traces')" + "py.iplot(fig, filename='facet - box traces')" ] }, { @@ -497,7 +539,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -506,7 +548,7 @@ "text": [ "Help on function create_facet_grid in module plotly.figure_factory._facet_grid:\n", "\n", - "create_facet_grid(df, x, y, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)\n", + "create_facet_grid(df, x=None, y=None, facet_row=None, facet_col=None, color_name=None, colormap=None, color_is_cat=False, facet_row_labels=None, facet_col_labels=None, height=None, width=None, trace_type='scatter', scales='fixed', dtick_x=None, dtick_y=None, show_boxes=True, ggplot2=False, binsize=1, **kwargs)\n", " Returns figure for facet grid.\n", " \n", " :param (pd.DataFrame) df: the dataframe of columns for the facet grid.\n", @@ -536,7 +578,8 @@ " :param (int) height: the height of the facet grid figure.\n", " :param (int) width: the width of the facet grid figure.\n", " :param (str) trace_type: decides the type of plot to appear in the\n", - " facet grid. The options are 'scatter' and 'scattergl'.\n", + " facet grid. The options are 'scatter', 'scattergl', 'histogram',\n", + " 'bar', and 'box'.\n", " Default = 'scatter'.\n", " :param (str) scales: determines if axes have fixed ranges or not. Valid\n", " settings are 'fixed' (all axes fixed), 'free_x' (x axis free only),\n", @@ -567,7 +610,6 @@ " y='cty',\n", " facet_col='cyl',\n", " )\n", - " \n", " py.iplot(fig, filename='facet_grid_mpg_one_way_facet')\n", " ```\n", " \n", @@ -587,7 +629,6 @@ " facet_row='drv',\n", " facet_col='cyl',\n", " )\n", - " \n", " py.iplot(fig, filename='facet_grid_mpg_two_way_facet')\n", " ```\n", " \n", @@ -651,6 +692,25 @@ " \n", " py.iplot(fig, filename='facet_grid_mtcars_custom_labels')\n", " ```\n", + " \n", + " Example 6: Other Trace Type\n", + " ```\n", + " import plotly.plotly as py\n", + " import plotly.figure_factory as ff\n", + " \n", + " import pandas as pd\n", + " \n", + " mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')\n", + " \n", + " fig = ff.create_facet_grid(\n", + " mtcars,\n", + " x='wt',\n", + " facet_col='cyl',\n", + " trace_type='histogram',\n", + " )\n", + " \n", + " py.iplot(fig, filename='facet_grid_mtcars_other_trace_type')\n", + " ```\n", "\n" ] } @@ -661,7 +721,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -693,7 +753,7 @@ "output_type": "stream", "text": [ "Collecting git+https://github.com/plotly/publisher.git\n", - " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-oaUMZq-build\n", + " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-Qtdk2b-build\n", "Installing collected packages: publisher\n", " Found existing installation: publisher 0.10\n", " Uninstalling publisher-0.10:\n", From 94a8105edb51f5cf3c95374ed60e89b275447a12 Mon Sep 17 00:00:00 2001 From: Kully Date: Mon, 3 Jul 2017 10:10:55 -0400 Subject: [PATCH 4/5] chelsea's comments --- .../2015-06-30-facet-and-trellis-plots.html | 13 +++-- .../facet-and-trellis-plots.ipynb | 48 ++++--------------- 2 files changed, 16 insertions(+), 45 deletions(-) diff --git a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html index 1cb2d0d3a716..ddf8a1ef2d3b 100644 --- a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html +++ b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html @@ -1,16 +1,15 @@ --- permalink: python/facet-trellis/ description: How to make Facet and Trellis Plots in Python with Plotly. -name: Facet and Trellis Plots | plotly +name: Facet and Trellis Plots has_thumbnail: true thumbnail: thumbnail/facet-trellis-thumbnail.jpg layout: user-guide -name: Facet and Trellis Plots language: python title: Python Facet and Trellis Plots | plotly display_as: statistical has_thumbnail: true -page_type: u-guide +page_type: example_index order: 10.2 --- {% raw %} @@ -419,7 +418,7 @@

Custom Labelsx='wt', y='mpg', facet_col='cyl', - facet_col_labels={4: "$\\alpha$", 6: '$\\beta$', 8: '$\sqrt[y]{x}$'}, + facet_col_labels={4: '$2^2 = 4$', 6: '$\\frac{18}{3} = 6$', 8: '$2\cdot4 = 8$'}, marker={'color': 'rgb(240, 100, 2)'}, ) @@ -625,7 +624,7 @@

Other Trace Types
-
In [17]:
+
In [13]:
-
In [18]:
+
In [14]:
help(ff.create_facet_grid)
diff --git a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
index 94478ed4c790..2920eed34b07 100644
--- a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
+++ b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb
@@ -344,7 +344,7 @@
     "    x='wt',\n",
     "    y='mpg',\n",
     "    facet_col='cyl',\n",
-    "    facet_col_labels={4: \"$\\\\alpha$\", 6: '$\\\\beta$', 8: '$\\sqrt[y]{x}$'},\n",
+    "    facet_col_labels={4: '$2^2 = 4$', 6: '$\\\\frac{18}{3} = 6$', 8: '$2\\cdot4 = 8$'},\n",
     "    marker={'color': 'rgb(240, 100, 2)'},\n",
     ")\n",
     "\n",
@@ -495,7 +495,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 13,
    "metadata": {},
    "outputs": [
     {
@@ -507,7 +507,7 @@
        ""
       ]
      },
-     "execution_count": 12,
+     "execution_count": 13,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -539,7 +539,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 14,
    "metadata": {},
    "outputs": [
     {
@@ -721,39 +721,15 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 15,
    "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 /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-Qtdk2b-build\n",
+      "  Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-izMtrr-build\n",
       "Installing collected packages: publisher\n",
       "  Found existing installation: publisher 0.10\n",
       "    Uninstalling publisher-0.10:\n",
@@ -778,20 +754,16 @@
     }
    ],
    "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",
-    "    'facet-and-trellis-plots.ipynb', 'python/facet-trellis/', 'Facet and Trellis Plots | plotly',\n",
+    "    'facet-and-trellis-plots.ipynb', 'python/facet-trellis/', 'Facet and Trellis Plots',\n",
     "    'How to make Facet and Trellis Plots in Python with Plotly.',\n",
     "    title = 'Python Facet and Trellis Plots | plotly',\n",
-    "    name = 'Facet and Trellis Plots',\n",
     "    has_thumbnail='true', thumbnail='thumbnail/facet-trellis-thumbnail.jpg',\n",
-    "    language='python', display_as='statistical', order=10.2)"
+    "    language='python', \n",
+    "    page_type='example_index',\n",
+    "    display_as='statistical', order=10.2)"
    ]
   },
   {

From 0cec298d75a5fcdfabe0607fc573b992c987bb83 Mon Sep 17 00:00:00 2001
From: Kully 
Date: Mon, 3 Jul 2017 13:11:37 -0400
Subject: [PATCH 5/5] updated version num

---
 .../facet-trellis/2015-06-30-facet-and-trellis-plots.html   | 2 +-
 .../statistical/facet-trellis/facet-and-trellis-plots.ipynb | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
index ddf8a1ef2d3b..cfee60861827 100644
--- a/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
+++ b/_posts/python/statistical/facet-trellis/2015-06-30-facet-and-trellis-plots.html
@@ -28,7 +28,7 @@ 

New to Plotly?
-

Version Check¶

Note: Facet Grids and Trellis Plots are available in version 2.0.10+
+

Version Check¶

Note: Facet Grids and Trellis Plots are available in version 2.0.12+
Run pip install plotly --upgrade to update your Plotly version

diff --git a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb index 2920eed34b07..129da197d38b 100644 --- a/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb +++ b/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb @@ -15,7 +15,7 @@ "metadata": {}, "source": [ "#### Version Check\n", - "Note: `Facet Grids and Trellis Plots` are available in version 2.0.10+
\n", + "Note: `Facet Grids and Trellis Plots` are available in version 2.0.12+
\n", "Run `pip install plotly --upgrade` to update your Plotly version" ] }, @@ -721,7 +721,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -729,7 +729,7 @@ "output_type": "stream", "text": [ "Collecting git+https://github.com/plotly/publisher.git\n", - " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-izMtrr-build\n", + " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-17TecQ-build\n", "Installing collected packages: publisher\n", " Found existing installation: publisher 0.10\n", " Uninstalling publisher-0.10:\n",