提交 99874d7e 编写于 作者: W wizardforcel

init

上级
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.DS_Store
# gitbook
_book
# node.js
node_modules
# windows
Thumbs.db
# word
~$*.docx
~$*.doc
---
permalink: /404.html
---
<script>window.location.href = '/';</script>
seaborn.apachecn.org
\ No newline at end of file
# 贡献指南
> 请您勇敢地去翻译和改进翻译。虽然我们追求卓越,但我们并不要求您做到十全十美,因此请不要担心因为翻译上犯错——在大部分情况下,我们的服务器已经记录所有的翻译,因此您不必担心会因为您的失误遭到无法挽回的破坏。(改编自维基百科)
负责人:
+ [飞龙](https://github.com/wizardforcel):562826179
## 章节列表
+ [An introduction to seaborn](docs/1.md)
+ [Installing and getting started](docs/2.md)
+ [Visualizing statistical relationships](docs/3.md)
+ [Plotting with categorical data](docs/4.md)
+ [Visualizing the distribution of a dataset](docs/5.md)
+ [Visualizing linear relationships](docs/6.md)
+ [Building structured multi-plot grids](docs/7.md)
+ [Controlling figure aesthetics](docs/8.md)
+ [Choosing color palettes](docs/9.md)
+ [seaborn.relplot](docs/10.md)
+ [seaborn.scatterplot](docs/11.md)
+ [seaborn.lineplot](docs/12.md)
+ [seaborn.catplot](docs/13.md)
+ [seaborn.stripplot](docs/14.md)
+ [seaborn.swarmplot](docs/15.md)
+ [seaborn.boxplot](docs/16.md)
+ [seaborn.violinplot](docs/17.md)
+ [seaborn.boxenplot](docs/18.md)
+ [seaborn.pointplot](docs/19.md)
+ [seaborn.barplot](docs/20.md)
+ [seaborn.countplot](docs/21.md)
+ [seaborn.jointplot](docs/22.md)
+ [seaborn.pairplot](docs/23.md)
+ [seaborn.distplot](docs/24.md)
+ [seaborn.kdeplot](docs/25.md)
+ [seaborn.rugplot](docs/26.md)
+ [seaborn.lmplot](docs/27.md)
+ [seaborn.regplot](docs/28.md)
+ [seaborn.residplot](docs/29.md)
+ [seaborn.heatmap](docs/30.md)
+ [seaborn.clustermap](docs/31.md)
+ [seaborn.FacetGrid](docs/32.md)
+ [seaborn.FacetGrid.map](docs/33.md)
+ [seaborn.FacetGrid.map_dataframe](docs/34.md)
+ [seaborn.PairGrid](docs/35.md)
+ [seaborn.PairGrid.map](docs/36.md)
+ [seaborn.PairGrid.map_diag](docs/37.md)
+ [seaborn.PairGrid.map_offdiag](docs/38.md)
+ [seaborn.PairGrid.map_lower](docs/39.md)
+ [seaborn.PairGrid.map_upper](docs/40.md)
+ [seaborn.JointGrid](docs/41.md)
+ [seaborn.JointGrid.plot](docs/42.md)
+ [seaborn.JointGrid.plot_joint](docs/43.md)
+ [seaborn.JointGrid.plot_marginals](docs/44.md)
+ [seaborn.set](docs/45.md)
+ [seaborn.axes_style](docs/46.md)
+ [seaborn.set_style](docs/47.md)
+ [seaborn.plotting_context](docs/48.md)
+ [seaborn.set_context](docs/49.md)
+ [seaborn.set_color_codes](docs/50.md)
+ [seaborn.reset_defaults](docs/51.md)
+ [seaborn.reset_orig](docs/52.md)
+ [seaborn.set_palette](docs/53.md)
+ [seaborn.color_palette](docs/54.md)
+ [seaborn.husl_palette](docs/55.md)
+ [seaborn.hls_palette](docs/56.md)
+ [seaborn.cubehelix_palette](docs/57.md)
+ [seaborn.dark_palette](docs/58.md)
+ [seaborn.light_palette](docs/59.md)
+ [seaborn.diverging_palette](docs/60.md)
+ [seaborn.blend_palette](docs/61.md)
+ [seaborn.xkcd_palette](docs/62.md)
+ [seaborn.crayon_palette](docs/63.md)
+ [seaborn.mpl_palette](docs/64.md)
+ [seaborn.choose_colorbrewer_palette](docs/65.md)
+ [seaborn.choose_cubehelix_palette](docs/66.md)
+ [seaborn.choose_light_palette](docs/67.md)
+ [seaborn.choose_dark_palette](docs/68.md)
+ [seaborn.choose_diverging_palette](docs/69.md)
+ [seaborn.load_dataset](docs/70.md)
+ [seaborn.despine](docs/71.md)
+ [seaborn.desaturate](docs/72.md)
+ [seaborn.saturate](docs/73.md)
+ [seaborn.set_hls_values](docs/74.md)
## 流程
### 一、认领
首先查看[整体进度](https://github.com/apachecn/seaborn-doc-zh/issues/1),确认没有人认领了你想认领的章节。
然后回复 ISSUE,注明“章节 + QQ 号”(一定要留 QQ)。
### 二、翻译
可以合理利用翻译引擎(例如[谷歌](https://translate.google.cn/)),但一定要把它变得可读!
如果遇到格式问题,请随手把它改正。
### 三、提交
+ `fork` Github 项目
+ 将译文放在`docs`文件夹下
+ `push`
+ `pull request`
请见 [Github 入门指南](https://github.com/apachecn/kaggle/blob/dev/docs/GitHub)
# seaborn 0.9 中文文档
> 协议:[CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/)
>
> 欢迎任何人参与和完善:一个人可以走的很快,但是一群人却可以走的更远。
* [在线阅读](https://apachecn.github.io/seaborn-doc-zh)
* [贡献指南](CONTRIBUTING.md)
* [ApacheCN 机器学习交流群 629470233](http://shang.qq.com/wpa/qunwpa?idkey=30e5f1123a79867570f665aa3a483ca404b1c3f77737bc01ec520ed5f078ddef)
* [ApacheCN 学习资源](http://www.apachecn.org/)
## 联系方式
### 负责人
+ [飞龙](https://github.com/wizardforcel):562826179
### 其他
* 认领翻译和项目进度-地址: <https://github.com/apachecn/seaborn-doc-zh/issues/1>
* 在我们的 [apachecn/seaborn-doc-zh](https://github.com/apachecn/seaborn-doc-zh) github 上提 issue.
* 发邮件到 Email: `apachecn@163.com`.
* 在我们的 [组织学习交流群](http://www.apachecn.org/organization/348.html) 中联系群主/管理员即可.
## 赞助我们
![](https://www.apachecn.org/img/about/donate.jpg)
+ [seaborn 0.9 中文文档](README.md)
+ [An introduction to seaborn](docs/1.md)
+ [Installing and getting started](docs/2.md)
+ [Visualizing statistical relationships](docs/3.md)
+ [Plotting with categorical data](docs/4.md)
+ [Visualizing the distribution of a dataset](docs/5.md)
+ [Visualizing linear relationships](docs/6.md)
+ [Building structured multi-plot grids](docs/7.md)
+ [Controlling figure aesthetics](docs/8.md)
+ [Choosing color palettes](docs/9.md)
+ [seaborn.relplot](docs/10.md)
+ [seaborn.scatterplot](docs/11.md)
+ [seaborn.lineplot](docs/12.md)
+ [seaborn.catplot](docs/13.md)
+ [seaborn.stripplot](docs/14.md)
+ [seaborn.swarmplot](docs/15.md)
+ [seaborn.boxplot](docs/16.md)
+ [seaborn.violinplot](docs/17.md)
+ [seaborn.boxenplot](docs/18.md)
+ [seaborn.pointplot](docs/19.md)
+ [seaborn.barplot](docs/20.md)
+ [seaborn.countplot](docs/21.md)
+ [seaborn.jointplot](docs/22.md)
+ [seaborn.pairplot](docs/23.md)
+ [seaborn.distplot](docs/24.md)
+ [seaborn.kdeplot](docs/25.md)
+ [seaborn.rugplot](docs/26.md)
+ [seaborn.lmplot](docs/27.md)
+ [seaborn.regplot](docs/28.md)
+ [seaborn.residplot](docs/29.md)
+ [seaborn.heatmap](docs/30.md)
+ [seaborn.clustermap](docs/31.md)
+ [seaborn.FacetGrid](docs/32.md)
+ [seaborn.FacetGrid.map](docs/33.md)
+ [seaborn.FacetGrid.map_dataframe](docs/34.md)
+ [seaborn.PairGrid](docs/35.md)
+ [seaborn.PairGrid.map](docs/36.md)
+ [seaborn.PairGrid.map_diag](docs/37.md)
+ [seaborn.PairGrid.map_offdiag](docs/38.md)
+ [seaborn.PairGrid.map_lower](docs/39.md)
+ [seaborn.PairGrid.map_upper](docs/40.md)
+ [seaborn.JointGrid](docs/41.md)
+ [seaborn.JointGrid.plot](docs/42.md)
+ [seaborn.JointGrid.plot_joint](docs/43.md)
+ [seaborn.JointGrid.plot_marginals](docs/44.md)
+ [seaborn.set](docs/45.md)
+ [seaborn.axes_style](docs/46.md)
+ [seaborn.set_style](docs/47.md)
+ [seaborn.plotting_context](docs/48.md)
+ [seaborn.set_context](docs/49.md)
+ [seaborn.set_color_codes](docs/50.md)
+ [seaborn.reset_defaults](docs/51.md)
+ [seaborn.reset_orig](docs/52.md)
+ [seaborn.set_palette](docs/53.md)
+ [seaborn.color_palette](docs/54.md)
+ [seaborn.husl_palette](docs/55.md)
+ [seaborn.hls_palette](docs/56.md)
+ [seaborn.cubehelix_palette](docs/57.md)
+ [seaborn.dark_palette](docs/58.md)
+ [seaborn.light_palette](docs/59.md)
+ [seaborn.diverging_palette](docs/60.md)
+ [seaborn.blend_palette](docs/61.md)
+ [seaborn.xkcd_palette](docs/62.md)
+ [seaborn.crayon_palette](docs/63.md)
+ [seaborn.mpl_palette](docs/64.md)
+ [seaborn.choose_colorbrewer_palette](docs/65.md)
+ [seaborn.choose_cubehelix_palette](docs/66.md)
+ [seaborn.choose_light_palette](docs/67.md)
+ [seaborn.choose_dark_palette](docs/68.md)
+ [seaborn.choose_diverging_palette](docs/69.md)
+ [seaborn.load_dataset](docs/70.md)
+ [seaborn.despine](docs/71.md)
+ [seaborn.desaturate](docs/72.md)
+ [seaborn.saturate](docs/73.md)
+ [seaborn.set_hls_values](docs/74.md)
此差异已折叠。
# seaborn.relplot
```py
seaborn.relplot(x=None, y=None, hue=None, size=None, style=None, data=None, row=None, col=None, col_wrap=None, row_order=None, col_order=None, palette=None, hue_order=None, hue_norm=None, sizes=None, size_order=None, size_norm=None, markers=None, dashes=None, style_order=None, legend='brief', kind='scatter', height=5, aspect=1, facet_kws=None, **kwargs)
```
Figure-level interface for drawing relational plots onto a FacetGrid.
This function provides access to several different axes-level functions that show the relationship between two variables with semantic mappings of subsets. The `kind` parameter selects the underlying axes-level function to use:
* [`scatterplot()`](seaborn.scatterplot.html#seaborn.scatterplot "seaborn.scatterplot") (with `kind="scatter"`; the default)
* [`lineplot()`](seaborn.lineplot.html#seaborn.lineplot "seaborn.lineplot") (with `kind="line"`)
Extra keyword arguments are passed to the underlying function, so you should refer to the documentation for each to see kind-specific options.
The relationship between `x` and `y` can be shown for different subsets of the data using the `hue`, `size`, and `style` parameters. These parameters control what visual semantics are used to identify the different subsets. It is possible to show up to three dimensions independently by using all three semantic types, but this style of plot can be hard to interpret and is often ineffective. Using redundant semantics (i.e. both `hue` and `style` for the same variable) can be helpful for making graphics more accessible.
See the [tutorial](../tutorial/relational.html#relational-tutorial) for more information.
After plotting, the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") with the plot is returned and can be used directly to tweak supporting plot details or add other layers.
Note that, unlike when using the underlying plotting functions directly, data must be passed in a long-form DataFrame with variables specified by passing strings to `x`, `y`, and other parameters.
| Parameters: | **x, y** : names of variables in `data`
> Input data variables; must be numeric.
**hue** : name in `data`, optional
> Grouping variable that will produce elements with different colors. Can be either categorical or numeric, although color mapping will behave differently in latter case.
**size** : name in `data`, optional
> Grouping variable that will produce elements with different sizes. Can be either categorical or numeric, although size mapping will behave differently in latter case.
**style** : name in `data`, optional
> Grouping variable that will produce elements with different styles. Can have a numeric dtype but will always be treated as categorical.
**data** : DataFrame
> Tidy (“long-form”) dataframe where each column is a variable and each row is an observation.
**row, col** : names of variables in `data`, optional
> Categorical variables that will determine the faceting of the grid.
**col_wrap** : int, optional
> “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a `row` facet.
**row_order, col_order** : lists of strings, optional
> Order to organize the rows and/or columns of the grid in, otherwise the orders are inferred from the data objects.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**hue_order** : list, optional
> Specified order for the appearance of the `hue` variable levels, otherwise they are determined from the data. Not relevant when the `hue` variable is numeric.
**hue_norm** : tuple or Normalize object, optional
> Normalization in data units for colormap applied to the `hue` variable when it is numeric. Not relevant if it is categorical.
**sizes** : list, dict, or tuple, optional
> An object that determines how sizes are chosen when `size` is used. It can always be a list of size values or a dict mapping levels of the `size` variable to sizes. When `size` is numeric, it can also be a tuple specifying the minimum and maximum size to use such that other values are normalized within this range.
**size_order** : list, optional
> Specified order for appearance of the `size` variable levels, otherwise they are determined from the data. Not relevant when the `size` variable is numeric.
**size_norm** : tuple or Normalize object, optional
> Normalization in data units for scaling plot objects when the `size` variable is numeric.
**legend** : “brief”, “full”, or False, optional
> How to draw the legend. If “brief”, numeric `hue` and `size` variables will be represented with a sample of evenly spaced values. If “full”, every group will get an entry in the legend. If `False`, no legend data is added and no legend is drawn.
**kind** : string, optional
> Kind of plot to draw, corresponding to a seaborn relational plot. Options are {`scatter` and `line`}.
**height** : scalar, optional
> Height (in inches) of each facet. See also: `aspect`.
**aspect** : scalar, optional
> Aspect ratio of each facet, so that `aspect * height` gives the width of each facet in inches.
**facet_kws** : dict, optional
> Dictionary of other keyword arguments to pass to [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid").
**kwargs** : key, value pairings
> Other keyword arguments are passed through to the underlying plotting function.
|
| --- | --- |
| Returns: | **g** : [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid")
> Returns the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") object with the plot on it for further tweaking.
|
| --- | --- |
Examples
Draw a single facet to use the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") legend placement:
```py
>>> import seaborn as sns
>>> sns.set(style="ticks")
>>> tips = sns.load_dataset("tips")
>>> g = sns.relplot(x="total_bill", y="tip", hue="day", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-1.png](img/1c7fa44b0679b71a3e8e8a4e26d75963.jpg)
Facet on the columns with another variable:
```py
>>> g = sns.relplot(x="total_bill", y="tip",
... hue="day", col="time", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-2.png](img/f0eb2f840a13f8dbd2b829e6bb51c4af.jpg)
Facet on the columns and rows:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="day",
... col="time", row="sex", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-3.png](img/e6f2f0c866185be9801d43c59f348826.jpg)
“Wrap” many column facets into multiple rows:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="time",
... col="day", col_wrap=2, data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-4.png](img/a89db144a2f030e70603b92ba8728326.jpg)
Use multiple semantic variables on each facet with specified attributes:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="time", size="size",
... palette=["b", "r"], sizes=(10, 100),
... col="time", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-5.png](img/79d93fb6cd8974ec779ead1b35e2aad1.jpg)
Use a different kind of plot:
```py
>>> fmri = sns.load_dataset("fmri")
>>> g = sns.relplot(x="timepoint", y="signal",
... hue="event", style="event", col="region",
... kind="line", data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-6.png](img/f14f4331afb42bd5512f2c24a5140604.jpg)
Change the size of each facet:
```py
>>> g = sns.relplot(x="timepoint", y="signal",
... hue="event", style="event", col="region",
... height=5, aspect=.7, kind="line", data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-relplot-7.png](img/bcbb773f27f65051374518d1d859a486.jpg)
\ No newline at end of file
# seaborn.scatterplot
```py
seaborn.scatterplot(x=None, y=None, hue=None, style=None, size=None, data=None, palette=None, hue_order=None, hue_norm=None, sizes=None, size_order=None, size_norm=None, markers=True, style_order=None, x_bins=None, y_bins=None, units=None, estimator=None, ci=95, n_boot=1000, alpha='auto', x_jitter=None, y_jitter=None, legend='brief', ax=None, **kwargs)
```
Draw a scatter plot with possibility of several semantic groupings.
The relationship between `x` and `y` can be shown for different subsets of the data using the `hue`, `size`, and `style` parameters. These parameters control what visual semantics are used to identify the different subsets. It is possible to show up to three dimensions independently by using all three semantic types, but this style of plot can be hard to interpret and is often ineffective. Using redundant semantics (i.e. both `hue` and `style` for the same variable) can be helpful for making graphics more accessible.
See the [tutorial](../tutorial/relational.html#relational-tutorial) for more information.
| Parameters: | **x, y** : names of variables in `data` or vector data, optional
> Input data variables; must be numeric. Can pass data directly or reference columns in `data`.
**hue** : name of variables in `data` or vector data, optional
> Grouping variable that will produce points with different colors. Can be either categorical or numeric, although color mapping will behave differently in latter case.
**size** : name of variables in `data` or vector data, optional
> Grouping variable that will produce points with different sizes. Can be either categorical or numeric, although size mapping will behave differently in latter case.
**style** : name of variables in `data` or vector data, optional
> Grouping variable that will produce points with different markers. Can have a numeric dtype but will always be treated as categorical.
**data** : DataFrame
> Tidy (“long-form”) dataframe where each column is a variable and each row is an observation.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**hue_order** : list, optional
> Specified order for the appearance of the `hue` variable levels, otherwise they are determined from the data. Not relevant when the `hue` variable is numeric.
**hue_norm** : tuple or Normalize object, optional
> Normalization in data units for colormap applied to the `hue` variable when it is numeric. Not relevant if it is categorical.
**sizes** : list, dict, or tuple, optional
> An object that determines how sizes are chosen when `size` is used. It can always be a list of size values or a dict mapping levels of the `size` variable to sizes. When `size` is numeric, it can also be a tuple specifying the minimum and maximum size to use such that other values are normalized within this range.
**size_order** : list, optional
> Specified order for appearance of the `size` variable levels, otherwise they are determined from the data. Not relevant when the `size` variable is numeric.
**size_norm** : tuple or Normalize object, optional
> Normalization in data units for scaling plot objects when the `size` variable is numeric.
**markers** : boolean, list, or dictionary, optional
> Object determining how to draw the markers for different levels of the `style` variable. Setting to `True` will use default markers, or you can pass a list of markers or a dictionary mapping levels of the `style` variable to markers. Setting to `False` will draw marker-less lines. Markers are specified as in matplotlib.
**style_order** : list, optional
> Specified order for appearance of the `style` variable levels otherwise they are determined from the data. Not relevant when the `style` variable is numeric.
**{x,y}_bins** : lists or arrays or functions
> _Currently non-functional._
**units** : {long_form_var}
> Grouping variable identifying sampling units. When used, a separate line will be drawn for each unit with appropriate semantics, but no legend entry will be added. Useful for showing distribution of experimental replicates when exact identities are not needed.
>
> _Currently non-functional._
**estimator** : name of pandas method or callable or None, optional
> Method for aggregating across multiple observations of the `y` variable at the same `x` level. If `None`, all observations will be drawn. _Currently non-functional._
**ci** : int or “sd” or None, optional
> Size of the confidence interval to draw when aggregating with an estimator. “sd” means to draw the standard deviation of the data. Setting to `None` will skip bootstrapping. _Currently non-functional._
**n_boot** : int, optional
> Number of bootstraps to use for computing the confidence interval. _Currently non-functional._
**alpha** : float
> Proportional opacity of the points.
**{x,y}_jitter** : booleans or floats
> _Currently non-functional._
**legend** : “brief”, “full”, or False, optional
> How to draw the legend. If “brief”, numeric `hue` and `size` variables will be represented with a sample of evenly spaced values. If “full”, every group will get an entry in the legend. If `False`, no legend data is added and no legend is drawn.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed down to `plt.scatter` at draw time.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
Show the relationship between two variables connected with lines to emphasize continuity.Draw a scatter plot with one categorical variable, arranging the points to show the distribution of values.
Examples
Draw a simple scatter plot between two variables:
```py
>>> import seaborn as sns; sns.set()
>>> import matplotlib.pyplot as plt
>>> tips = sns.load_dataset("tips")
>>> ax = sns.scatterplot(x="total_bill", y="tip", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-1.png](img/0c0c7dd9c7bdb6a6490d4f09db142ec7.jpg)
Group by another variable and show the groups with different colors:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip", hue="time",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-2.png](img/7fa2188b7e7f18a4af451121d39996f0.jpg)
Show the grouping variable by varying both color and marker:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="time", style="time", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-3.png](img/efc3bf2e49e981db42de96bfa2fbf3c3.jpg)
Vary colors and markers to show two different grouping variables:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="day", style="time", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-4.png](img/9cd2a9e38e483ecbe02a7f0d0b67aac3.jpg)
Show a quantitative variable by varying the size of the points:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip", size="size",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-5.png](img/eed42ab8c9334459069ea90987d5a184.jpg)
Also show the quantitative variable by also using continuous colors:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="size", size="size",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-6.png](img/2777268c97b2e7b9d1e8269eb5a30c32.jpg)
Use a different continuous color map:
```py
>>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="size", size="size",
... palette=cmap,
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-7.png](img/6254a35c0308633b36668290c5aecadd.jpg)
Change the minimum and maximum point size and show all sizes in legend:
```py
>>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="size", size="size",
... sizes=(20, 200), palette=cmap,
... legend="full", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-8.png](img/8dce33a113d5097dca0507c737d018d4.jpg)
Use a narrower range of color map intensities:
```py
>>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="size", size="size",
... sizes=(20, 200), hue_norm=(0, 7),
... legend="full", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-9.png](img/83eadbdb8a87de2c9615c02d627bb299.jpg)
Vary the size with a categorical variable, and use a different palette:
```py
>>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... hue="day", size="smoker",
... palette="Set2",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-10.png](img/a5b1731f0fcd91611390c0bb109cfe64.jpg)
Use a specific set of markers:
```py
>>> markers = {"Lunch": "s", "Dinner": "X"}
>>> ax = sns.scatterplot(x="total_bill", y="tip", style="time",
... markers=markers,
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-11.png](img/d36b6251be5569fe2c31daea7543bf8a.jpg)
Control plot attributes using matplotlib parameters:
```py
>>> ax = sns.scatterplot(x="total_bill", y="tip",
... s=100, color=".2", marker="+",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-12.png](img/6096554e5a6fc5659cb1506870489993.jpg)
Pass data vectors instead of names in a data frame:
```py
>>> iris = sns.load_dataset("iris")
>>> ax = sns.scatterplot(x=iris.sepal_length, y=iris.sepal_width,
... hue=iris.species, style=iris.species)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-13.png](img/5efb6c24bde137217b7d6471bd9e806a.jpg)
Pass a wide-form dataset and plot against its index:
```py
>>> import numpy as np, pandas as pd; plt.close("all")
>>> index = pd.date_range("1 1 2000", periods=100,
... freq="m", name="date")
>>> data = np.random.randn(100, 4).cumsum(axis=0)
>>> wide_df = pd.DataFrame(data, index, ["a", "b", "c", "d"])
>>> ax = sns.scatterplot(data=wide_df)
```
![http://seaborn.pydata.org/_images/seaborn-scatterplot-14.png](img/ef47abe0a6cdede1f181c16d59bd3fe0.jpg)
\ No newline at end of file
# seaborn.lineplot
```py
seaborn.lineplot(x=None, y=None, hue=None, size=None, style=None, data=None, palette=None, hue_order=None, hue_norm=None, sizes=None, size_order=None, size_norm=None, dashes=True, markers=None, style_order=None, units=None, estimator='mean', ci=95, n_boot=1000, sort=True, err_style='band', err_kws=None, legend='brief', ax=None, **kwargs)
```
Draw a line plot with possibility of several semantic groupings.
The relationship between `x` and `y` can be shown for different subsets of the data using the `hue`, `size`, and `style` parameters. These parameters control what visual semantics are used to identify the different subsets. It is possible to show up to three dimensions independently by using all three semantic types, but this style of plot can be hard to interpret and is often ineffective. Using redundant semantics (i.e. both `hue` and `style` for the same variable) can be helpful for making graphics more accessible.
See the [tutorial](../tutorial/relational.html#relational-tutorial) for more information.
By default, the plot aggregates over multiple `y` values at each value of `x` and shows an estimate of the central tendency and a confidence interval for that estimate.
| Parameters: | **x, y** : names of variables in `data` or vector data, optional
> Input data variables; must be numeric. Can pass data directly or reference columns in `data`.
**hue** : name of variables in `data` or vector data, optional
> Grouping variable that will produce lines with different colors. Can be either categorical or numeric, although color mapping will behave differently in latter case.
**size** : name of variables in `data` or vector data, optional
> Grouping variable that will produce lines with different widths. Can be either categorical or numeric, although size mapping will behave differently in latter case.
**style** : name of variables in `data` or vector data, optional
> Grouping variable that will produce lines with different dashes and/or markers. Can have a numeric dtype but will always be treated as categorical.
**data** : DataFrame
> Tidy (“long-form”) dataframe where each column is a variable and each row is an observation.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**hue_order** : list, optional
> Specified order for the appearance of the `hue` variable levels, otherwise they are determined from the data. Not relevant when the `hue` variable is numeric.
**hue_norm** : tuple or Normalize object, optional
> Normalization in data units for colormap applied to the `hue` variable when it is numeric. Not relevant if it is categorical.
**sizes** : list, dict, or tuple, optional
> An object that determines how sizes are chosen when `size` is used. It can always be a list of size values or a dict mapping levels of the `size` variable to sizes. When `size` is numeric, it can also be a tuple specifying the minimum and maximum size to use such that other values are normalized within this range.
**size_order** : list, optional
> Specified order for appearance of the `size` variable levels, otherwise they are determined from the data. Not relevant when the `size` variable is numeric.
**size_norm** : tuple or Normalize object, optional
> Normalization in data units for scaling plot objects when the `size` variable is numeric.
**dashes** : boolean, list, or dictionary, optional
> Object determining how to draw the lines for different levels of the `style` variable. Setting to `True` will use default dash codes, or you can pass a list of dash codes or a dictionary mapping levels of the `style` variable to dash codes. Setting to `False` will use solid lines for all subsets. Dashes are specified as in matplotlib: a tuple of `(segment, gap)` lengths, or an empty string to draw a solid line.
**markers** : boolean, list, or dictionary, optional
> Object determining how to draw the markers for different levels of the `style` variable. Setting to `True` will use default markers, or you can pass a list of markers or a dictionary mapping levels of the `style` variable to markers. Setting to `False` will draw marker-less lines. Markers are specified as in matplotlib.
**style_order** : list, optional
> Specified order for appearance of the `style` variable levels otherwise they are determined from the data. Not relevant when the `style` variable is numeric.
**units** : {long_form_var}
> Grouping variable identifying sampling units. When used, a separate line will be drawn for each unit with appropriate semantics, but no legend entry will be added. Useful for showing distribution of experimental replicates when exact identities are not needed.
**estimator** : name of pandas method or callable or None, optional
> Method for aggregating across multiple observations of the `y` variable at the same `x` level. If `None`, all observations will be drawn.
**ci** : int or “sd” or None, optional
> Size of the confidence interval to draw when aggregating with an estimator. “sd” means to draw the standard deviation of the data. Setting to `None` will skip bootstrapping.
**n_boot** : int, optional
> Number of bootstraps to use for computing the confidence interval.
**sort** : boolean, optional
> If True, the data will be sorted by the x and y variables, otherwise lines will connect points in the order they appear in the dataset.
**err_style** : “band” or “bars”, optional
> Whether to draw the confidence intervals with translucent error bands or discrete error bars.
**err_band** : dict of keyword arguments
> Additional paramters to control the aesthetics of the error bars. The kwargs are passed either to `ax.fill_between` or `ax.errorbar`, depending on the `err_style`.
**legend** : “brief”, “full”, or False, optional
> How to draw the legend. If “brief”, numeric `hue` and `size` variables will be represented with a sample of evenly spaced values. If “full”, every group will get an entry in the legend. If `False`, no legend data is added and no legend is drawn.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed down to `plt.plot` at draw time.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
Show the relationship between two variables without emphasizing continuity of the `x` variable.Show the relationship between two variables when one is categorical.
Examples
Draw a single line plot with error bands showing a confidence interval:
```py
>>> import seaborn as sns; sns.set()
>>> import matplotlib.pyplot as plt
>>> fmri = sns.load_dataset("fmri")
>>> ax = sns.lineplot(x="timepoint", y="signal", data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-1.png](img/25ad91543cb2ac105ccfb3efc544658a.jpg)
Group by another variable and show the groups with different colors:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
... data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-2.png](img/5d2d2c464b8872f780180217182517d4.jpg)
Show the grouping variable with both color and line dashing:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal",
... hue="event", style="event", data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-3.png](img/2e99f3ab69ddcc3a94df1ddb15068249.jpg)
Use color and line dashing to represent two different grouping variables:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal",
... hue="region", style="event", data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-4.png](img/7c717f27fe7c1e02672338abf7cad829.jpg)
Use markers instead of the dashes to identify groups:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal",
... hue="event", style="event",
... markers=True, dashes=False, data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-5.png](img/f82003c5544990262fe9a61a131d93ef.jpg)
Show error bars instead of error bands and plot the standard error:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
... err_style="bars", ci=68, data=fmri)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-6.png](img/a92991eef59fbedc422f330f51697fe4.jpg)
Show experimental replicates instead of aggregating:
```py
>>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
... units="subject", estimator=None, lw=1,
... data=fmri.query("region == 'frontal'"))
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-7.png](img/d7a78945c0ae60bbd5ee9dfef15baba0.jpg)
Use a quantitative color mapping:
```py
>>> dots = sns.load_dataset("dots").query("align == 'dots'")
>>> ax = sns.lineplot(x="time", y="firing_rate",
... hue="coherence", style="choice",
... data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-8.png](img/bc93752a335d8985139584678e19a2b9.jpg)
Use a different normalization for the colormap:
```py
>>> from matplotlib.colors import LogNorm
>>> ax = sns.lineplot(x="time", y="firing_rate",
... hue="coherence", style="choice",
... hue_norm=LogNorm(), data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-9.png](img/1848472fd25a5227de0c58b2fc43c865.jpg)
Use a different color palette:
```py
>>> ax = sns.lineplot(x="time", y="firing_rate",
... hue="coherence", style="choice",
... palette="ch:2.5,.25", data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-10.png](img/f758b47e18df4e0b8e31c3a3fb9a1634.jpg)
Use specific color values, treating the hue variable as categorical:
```py
>>> palette = sns.color_palette("mako_r", 6)
>>> ax = sns.lineplot(x="time", y="firing_rate",
... hue="coherence", style="choice",
... palette=palette, data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-11.png](img/f91976efc3d73db2b134c57ba7dd86f3.jpg)
Change the width of the lines with a quantitative variable:
```py
>>> ax = sns.lineplot(x="time", y="firing_rate",
... size="coherence", hue="choice",
... legend="full", data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-12.png](img/f7c110a02ff0dffcc8a6c88582b45b70.jpg)
Change the range of line widths used to normalize the size variable:
```py
>>> ax = sns.lineplot(x="time", y="firing_rate",
... size="coherence", hue="choice",
... sizes=(.25, 2.5), data=dots)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-13.png](img/438199f3698b863dd842a2f680c4a845.jpg)
Plot from a wide-form DataFrame:
```py
>>> import numpy as np, pandas as pd; plt.close("all")
>>> index = pd.date_range("1 1 2000", periods=100,
... freq="m", name="date")
>>> data = np.random.randn(100, 4).cumsum(axis=0)
>>> wide_df = pd.DataFrame(data, index, ["a", "b", "c", "d"])
>>> ax = sns.lineplot(data=wide_df)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-14.png](img/25659857727e22d0f951f9c750bb29de.jpg)
Plot from a list of Series:
```py
>>> list_data = [wide_df.loc[:"2005", "a"], wide_df.loc["2003":, "b"]]
>>> ax = sns.lineplot(data=list_data)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-15.png](img/711ff3dd5a0aef63679fe4174259ee3d.jpg)
Plot a single Series, pass kwargs to `plt.plot`:
```py
>>> ax = sns.lineplot(data=wide_df["a"], color="coral", label="line")
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-16.png](img/fde16964145ae355ddbbeae37728260a.jpg)
Draw lines at points as they appear in the dataset:
```py
>>> x, y = np.random.randn(2, 5000).cumsum(axis=1)
>>> ax = sns.lineplot(x=x, y=y, sort=False, lw=1)
```
![http://seaborn.pydata.org/_images/seaborn-lineplot-17.png](img/05782b02c2faaf09a504b53a5a526445.jpg)
\ No newline at end of file
# seaborn.catplot
```py
seaborn.catplot(x=None, y=None, hue=None, data=None, row=None, col=None, col_wrap=None, estimator=<function mean>, ci=95, n_boot=1000, units=None, order=None, hue_order=None, row_order=None, col_order=None, kind='strip', height=5, aspect=1, orient=None, color=None, palette=None, legend=True, legend_out=True, sharex=True, sharey=True, margin_titles=False, facet_kws=None, **kwargs)
```
Figure-level interface for drawing categorical plots onto a FacetGrid.
This function provides access to several axes-level functions that show the relationship between a numerical and one or more categorical variables using one of several visual representations. The `kind` parameter selects the underlying axes-level function to use:
Categorical scatterplots:
* [`stripplot()`](seaborn.stripplot.html#seaborn.stripplot "seaborn.stripplot") (with `kind="strip"`; the default)
* [`swarmplot()`](seaborn.swarmplot.html#seaborn.swarmplot "seaborn.swarmplot") (with `kind="swarm"`)
Categorical distribution plots:
* [`boxplot()`](seaborn.boxplot.html#seaborn.boxplot "seaborn.boxplot") (with `kind="box"`)
* [`violinplot()`](seaborn.violinplot.html#seaborn.violinplot "seaborn.violinplot") (with `kind="violin"`)
* [`boxenplot()`](seaborn.boxenplot.html#seaborn.boxenplot "seaborn.boxenplot") (with `kind="boxen"`)
Categorical estimate plots:
* [`pointplot()`](seaborn.pointplot.html#seaborn.pointplot "seaborn.pointplot") (with `kind="point"`)
* [`barplot()`](seaborn.barplot.html#seaborn.barplot "seaborn.barplot") (with `kind="bar"`)
* [`countplot()`](seaborn.countplot.html#seaborn.countplot "seaborn.countplot") (with `kind="count"`)
Extra keyword arguments are passed to the underlying function, so you should refer to the documentation for each to see kind-specific options.
Note that unlike when using the axes-level functions directly, data must be passed in a long-form DataFrame with variables specified by passing strings to `x`, `y`, `hue`, etc.
As in the case with the underlying plot functions, if variables have a `categorical` data type, the the levels of the categorical variables, and their order will be inferred from the objects. Otherwise you may have to use alter the dataframe sorting or use the function parameters (`orient`, `order`, `hue_order`, etc.) to set up the plot correctly.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
After plotting, the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") with the plot is returned and can be used directly to tweak supporting plot details or add other layers.
| Parameters: | **x, y, hue** : names of variables in `data`
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame
> Long-form (tidy) dataset for plotting. Each column should correspond to a variable, and each row should correspond to an observation.
**row, col** : names of variables in `data`, optional
> Categorical variables that will determine the faceting of the grid.
**col_wrap** : int, optional
> “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a `row` facet.
**estimator** : callable that maps vector -&gt; scalar, optional
> Statistical function to estimate within each categorical bin.
**ci** : float or “sd” or None, optional
> Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations. If `None`, no bootstrapping will be performed, and error bars will not be drawn.
**n_boot** : int, optional
> Number of bootstrap iterations to use when computing confidence intervals.
**units** : name of variable in `data` or vector data, optional
> Identifier of sampling units, which will be used to perform a multilevel bootstrap and account for repeated measures design.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**row_order, col_order** : lists of strings, optional
> Order to organize the rows and/or columns of the grid in, otherwise the orders are inferred from the data objects.
**kind** : string, optional
> The kind of plot to draw (corresponds to the name of a categorical plotting function. Options are: “point”, “bar”, “strip”, “swarm”, “box”, “violin”, or “boxen”.
**height** : scalar, optional
> Height (in inches) of each facet. See also: `aspect`.
**aspect** : scalar, optional
> Aspect ratio of each facet, so that `aspect * height` gives the width of each facet in inches.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**legend** : bool, optional
> If `True` and there is a `hue` variable, draw a legend on the plot.
**legend_out** : bool, optional
> If `True`, the figure size will be extended, and the legend will be drawn outside the plot on the center right.
**share{x,y}** : bool, ‘col’, or ‘row’ optional
> If true, the facets will share y axes across columns and/or x axes across rows.
**margin_titles** : bool, optional
> If `True`, the titles for the row variable are drawn to the right of the last column. This option is experimental and may not work in all cases.
**facet_kws** : dict, optional
> Dictionary of other keyword arguments to pass to [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid").
**kwargs** : key, value pairings
> Other keyword arguments are passed through to the underlying plotting function.
|
| --- | --- |
| Returns: | **g** : [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid")
> Returns the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") object with the plot on it for further tweaking.
|
| --- | --- |
Examples
Draw a single facet to use the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") legend placement:
```py
>>> import seaborn as sns
>>> sns.set(style="ticks")
>>> exercise = sns.load_dataset("exercise")
>>> g = sns.catplot(x="time", y="pulse", hue="kind", data=exercise)
```
![http://seaborn.pydata.org/_images/seaborn-catplot-1.png](img/0b12363978e10369fc98bd33cb536d85.jpg)
Use a different plot kind to visualize the same data:
```py
>>> g = sns.catplot(x="time", y="pulse", hue="kind",
... data=exercise, kind="violin")
```
![http://seaborn.pydata.org/_images/seaborn-catplot-2.png](img/edd1fe3b83d3ec7ff2a1310bc2b87b8c.jpg)
Facet along the columns to show a third categorical variable:
```py
>>> g = sns.catplot(x="time", y="pulse", hue="kind",
... col="diet", data=exercise)
```
![http://seaborn.pydata.org/_images/seaborn-catplot-3.png](img/f54e97484ce6dfcae6e1ceafe18503af.jpg)
Use a different height and aspect ratio for the facets:
```py
>>> g = sns.catplot(x="time", y="pulse", hue="kind",
... col="diet", data=exercise,
... height=5, aspect=.8)
```
![http://seaborn.pydata.org/_images/seaborn-catplot-4.png](img/ff09acb1a4ecf2c617aa1323f8894fe5.jpg)
Make many column facets and wrap them into the rows of the grid:
```py
>>> titanic = sns.load_dataset("titanic")
>>> g = sns.catplot("alive", col="deck", col_wrap=4,
... data=titanic[titanic.deck.notnull()],
... kind="count", height=2.5, aspect=.8)
```
![http://seaborn.pydata.org/_images/seaborn-catplot-5.png](img/94e545c07037b66573b94c5d43e41899.jpg)
Plot horizontally and pass other keyword arguments to the plot function:
```py
>>> g = sns.catplot(x="age", y="embark_town",
... hue="sex", row="class",
... data=titanic[titanic.embark_town.notnull()],
... orient="h", height=2, aspect=3, palette="Set3",
... kind="violin", dodge=True, cut=0, bw=.2)
```
![http://seaborn.pydata.org/_images/seaborn-catplot-6.png](img/141f4c98341da1bc3beb4dc78e30df08.jpg)
Use methods on the returned [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") to tweak the presentation:
```py
>>> g = sns.catplot(x="who", y="survived", col="class",
... data=titanic, saturation=.5,
... kind="bar", ci=None, aspect=.6)
>>> (g.set_axis_labels("", "Survival Rate")
... .set_xticklabels(["Men", "Women", "Children"])
... .set_titles("{col_name} {col_var}")
... .set(ylim=(0, 1))
... .despine(left=True))
<seaborn.axisgrid.FacetGrid object at 0x...>
```
![http://seaborn.pydata.org/_images/seaborn-catplot-7.png](img/407bdac663f0df796492a65e635fca81.jpg)
\ No newline at end of file
# seaborn.stripplot
```py
seaborn.stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, jitter=True, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs)
```
Draw a scatterplot where one variable is categorical.
A strip plot can be drawn on its own, but it is also a good complement to a box or violin plot in cases where you want to show all observations along with some representation of the underlying distribution.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**jitter** : float, `True`/`1` is special-cased, optional
> Amount of jitter (only along the categorical axis) to apply. This can be useful when you have many points and they overlap, so that it is easier to see the distribution. You can specify the amount of jitter (half the width of the uniform random variable support), or just use `True` for a good default.
**dodge** : bool, optional
> When using `hue` nesting, setting this to `True` will separate the strips for different hue levels along the categorical axis. Otherwise, the points for each level will be plotted on top of each other.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**size** : float, optional
> Diameter of the markers, in points. (Although `plt.scatter` is used to draw the points, the `size` argument here takes a “normal” markersize and not size^2 like `plt.scatter`.
**edgecolor** : matplotlib color, “gray” is special-cased, optional
> Color of the lines around each point. If you pass `"gray"`, the brightness is determined by the color palette used for the body of the points.
**linewidth** : float, optional
> Width of the gray lines that frame the plot elements.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
A categorical scatterplot where the points do not overlap. Can be used with other plots to show each observation.A traditional box-and-whisker plot with a similar API.A combination of boxplot and kernel density estimation.
Examples
Draw a single horizontal strip plot:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.stripplot(x=tips["total_bill"])
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-1.png](img/23f314e72f6e5a8952dc9e9ad7e91951.jpg)
Group the strips by a categorical variable:
```py
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-2.png](img/e91e31fb6bd4af0c4a7726101c5498d5.jpg)
Add jitter to bring out the distribution of values:
```py
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=True)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-3.png](img/bb509cea6c5bc79011b7aae3d06f02af.jpg)
Use a smaller amount of jitter:
```py
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=0.05)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-4.png](img/187d29ea70c79f73b11ccc7bfa3d2dc3.jpg)
Draw horizontal strips:
```py
>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
... jitter=True)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-5.png](img/3f587e4b0523d3c3e09d9950a187d53c.jpg)
Draw outlines around the points:
```py
>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
... jitter=True, linewidth=1)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-6.png](img/808d1fbb36b6a8028b4e31ec238af4dc.jpg)
Nest the strips within a second categorical variable:
```py
>>> ax = sns.stripplot(x="sex", y="total_bill", hue="day",
... data=tips, jitter=True)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-7.png](img/6667c226e573f81913cd01ab631ca098.jpg)
Draw each level of the `hue` variable at different locations on the major categorical axis:
```py
>>> ax = sns.stripplot(x="day", y="total_bill", hue="smoker",
... data=tips, jitter=True,
... palette="Set2", dodge=True)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-8.png](img/877dac04cc4c90a1e6b62a3f4c75cb92.jpg)
Control strip order by passing an explicit order:
```py
>>> ax = sns.stripplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-9.png](img/582830f6213892477ca7f7fd8aea05e3.jpg)
Draw strips with large points and different aesthetics:
```py
>>> ax = sns.stripplot("day", "total_bill", "smoker", data=tips,
... palette="Set2", size=20, marker="D",
... edgecolor="gray", alpha=.25)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-10.png](img/8d98047d8f8f2021d6ee3b3a679f0890.jpg)
Draw strips of observations on top of a box plot:
```py
>>> ax = sns.boxplot(x="tip", y="day", data=tips, whis=np.inf)
>>> ax = sns.stripplot(x="tip", y="day", data=tips,
... jitter=True, color=".3")
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-11.png](img/4affd3f4e9c07c5d6803b935d775b36f.jpg)
Draw strips of observations on top of a violin plot:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", data=tips,
... inner=None, color=".8")
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=True)
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-12.png](img/a68cecbc7d2dbcff50e7244cafe440ec.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`stripplot()`](#seaborn.stripplot "seaborn.stripplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="strip",
... jitter=True,
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-stripplot-13.png](img/1b02f55ed166cfeb0628691d84bc1958.jpg)
\ No newline at end of file
# seaborn.swarmplot
```py
seaborn.swarmplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs)
```
Draw a categorical scatterplot with non-overlapping points.
This function is similar to [`stripplot()`](seaborn.stripplot.html#seaborn.stripplot "seaborn.stripplot"), but the points are adjusted (only along the categorical axis) so that they don’t overlap. This gives a better representation of the distribution of values, but it does not scale well to large numbers of observations. This style of plot is sometimes called a “beeswarm”.
A swarm plot can be drawn on its own, but it is also a good complement to a box or violin plot in cases where you want to show all observations along with some representation of the underlying distribution.
Arranging the points properly requires an accurate transformation between data and point coordinates. This means that non-default axis limits must be set _before_ drawing the plot.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**dodge** : bool, optional
> When using `hue` nesting, setting this to `True` will separate the strips for different hue levels along the categorical axis. Otherwise, the points for each level will be plotted in one swarm.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**size** : float, optional
> Diameter of the markers, in points. (Although `plt.scatter` is used to draw the points, the `size` argument here takes a “normal” markersize and not size^2 like `plt.scatter`.
**edgecolor** : matplotlib color, “gray” is special-cased, optional
> Color of the lines around each point. If you pass `"gray"`, the brightness is determined by the color palette used for the body of the points.
**linewidth** : float, optional
> Width of the gray lines that frame the plot elements.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
A traditional box-and-whisker plot with a similar API.A combination of boxplot and kernel density estimation.A scatterplot where one variable is categorical. Can be used in conjunction with other plots to show each observation.Combine a categorical plot with a class:<cite>FacetGrid</cite>.
Examples
Draw a single horizontal swarm plot:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.swarmplot(x=tips["total_bill"])
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-1.png](img/900c725fafc0f5e475a98f52f4ed7d04.jpg)
Group the swarms by a categorical variable:
```py
>>> ax = sns.swarmplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-2.png](img/414037bdbfc9b79cf5f12a30645f7301.jpg)
Draw horizontal swarms:
```py
>>> ax = sns.swarmplot(x="total_bill", y="day", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-3.png](img/b03c6dbcd2d2f71c2e5eafa99b46d96b.jpg)
Color the points using a second categorical variable:
```py
>>> ax = sns.swarmplot(x="day", y="total_bill", hue="sex", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-4.png](img/12d5e5950bf28b7027b28766bc41989f.jpg)
Split each level of the `hue` variable along the categorical axis:
```py
>>> ax = sns.swarmplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="Set2", dodge=True)
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-5.png](img/6f9585fcbe42e72521292b80b0fdc97a.jpg)
Control swarm order by passing an explicit order:
```py
>>> ax = sns.swarmplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-6.png](img/73bbf8c6208a6e1c0dda89091dd509a4.jpg)
Plot using larger points:
```py
>>> ax = sns.swarmplot(x="time", y="tip", data=tips, size=6)
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-7.png](img/34aa97c61dd6f6176fa2256880526439.jpg)
Draw swarms of observations on top of a box plot:
```py
>>> ax = sns.boxplot(x="tip", y="day", data=tips, whis=np.inf)
>>> ax = sns.swarmplot(x="tip", y="day", data=tips, color=".2")
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-8.png](img/d992e6312a3ed98025ad0913dbc46228.jpg)
Draw swarms of observations on top of a violin plot:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", data=tips, inner=None)
>>> ax = sns.swarmplot(x="day", y="total_bill", data=tips,
... color="white", edgecolor="gray")
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-9.png](img/735aa7eaadb9afb7a47a2d079b28a10b.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`swarmplot()`](#seaborn.swarmplot "seaborn.swarmplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="swarm",
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-swarmplot-10.png](img/7c1bc4a2871b9e0dbe2c23ed05fcae1b.jpg)
\ No newline at end of file
# seaborn.boxplot
```py
seaborn.boxplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, width=0.8, dodge=True, fliersize=5, linewidth=None, whis=1.5, notch=False, ax=None, **kwargs)
```
Draw a box plot to show distributions with respect to categories.
A box plot (or box-and-whisker plot) shows the distribution of quantitative data in a way that facilitates comparisons between variables or across levels of a categorical variable. The box shows the quartiles of the dataset while the whiskers extend to show the rest of the distribution, except for points that are determined to be “outliers” using a method that is a function of the inter-quartile range.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**saturation** : float, optional
> Proportion of the original saturation to draw colors at. Large patches often look better with slightly desaturated colors, but set this to `1` if you want the plot colors to perfectly match the input color spec.
**width** : float, optional
> Width of a full element when not using hue nesting, or width of all the elements for one level of the major grouping variable.
**dodge** : bool, optional
> When hue nesting is used, whether elements should be shifted along the categorical axis.
**fliersize** : float, optional
> Size of the markers used to indicate outlier observations.
**linewidth** : float, optional
> Width of the gray lines that frame the plot elements.
**whis** : float, optional
> Proportion of the IQR past the low and high quartiles to extend the plot whiskers. Points outside this range will be identified as outliers.
**notch** : boolean, optional
> Whether to “notch” the box to indicate a confidence interval for the median. There are several other parameters that can control how the notches are drawn; see the `plt.boxplot` help for more information on them.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed through to `plt.boxplot` at draw time.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
A combination of boxplot and kernel density estimation.A scatterplot where one variable is categorical. Can be used in conjunction with other plots to show each observation.A categorical scatterplot where the points do not overlap. Can be used with other plots to show each observation.
Examples
Draw a single horizontal boxplot:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.boxplot(x=tips["total_bill"])
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-1.png](img/a60c5e81f1e6cf2aeb7d9790851ca60d.jpg)
Draw a vertical boxplot grouped by a categorical variable:
```py
>>> ax = sns.boxplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-2.png](img/26d08ab02c44cb0a819065f27a1b7f84.jpg)
Draw a boxplot with nested grouping by two categorical variables:
```py
>>> ax = sns.boxplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="Set3")
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-3.png](img/d642aa20a439141528ed8a872a4822a4.jpg)
Draw a boxplot with nested grouping when some bins are empty:
```py
>>> ax = sns.boxplot(x="day", y="total_bill", hue="time",
... data=tips, linewidth=2.5)
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-4.png](img/97751f7296df86f26e8eb70275541082.jpg)
Control box order by passing an explicit order:
```py
>>> ax = sns.boxplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-5.png](img/8ac363c4f6fd1e8ef5a4dd62d236ce9d.jpg)
Draw a boxplot for each numeric variable in a DataFrame:
```py
>>> iris = sns.load_dataset("iris")
>>> ax = sns.boxplot(data=iris, orient="h", palette="Set2")
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-6.png](img/7592f72da714721ad272271754ee8454.jpg)
Use `hue` without changing box position or width:
```py
>>> tips["weekend"] = tips["day"].isin(["Sat", "Sun"])
>>> ax = sns.boxplot(x="day", y="total_bill", hue="weekend",
... data=tips, dodge=False)
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-7.png](img/583a43fccfad9c80a852b79bbd864c3b.jpg)
Use [`swarmplot()`](seaborn.swarmplot.html#seaborn.swarmplot "seaborn.swarmplot") to show the datapoints on top of the boxes:
```py
>>> ax = sns.boxplot(x="day", y="total_bill", data=tips)
>>> ax = sns.swarmplot(x="day", y="total_bill", data=tips, color=".25")
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-8.png](img/627c14ca4d7cabe1d122fd0b9d2586bd.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`pointplot()`](seaborn.pointplot.html#seaborn.pointplot "seaborn.pointplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="box",
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-boxplot-9.png](img/e992687c669c1747d5f18ff4d5e6457d.jpg)
\ No newline at end of file
# seaborn.violinplot
```py
seaborn.violinplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, bw='scott', cut=2, scale='area', scale_hue=True, gridsize=100, width=0.8, inner='box', split=False, dodge=True, orient=None, linewidth=None, color=None, palette=None, saturation=0.75, ax=None, **kwargs)
```
Draw a combination of boxplot and kernel density estimate.
A violin plot plays a similar role as a box and whisker plot. It shows the distribution of quantitative data across several levels of one (or more) categorical variables such that those distributions can be compared. Unlike a box plot, in which all of the plot components correspond to actual datapoints, the violin plot features a kernel density estimation of the underlying distribution.
This can be an effective and attractive way to show multiple distributions of data at once, but keep in mind that the estimation procedure is influenced by the sample size, and violins for relatively small samples might look misleadingly smooth.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**bw** : {‘scott’, ‘silverman’, float}, optional
> Either the name of a reference rule or the scale factor to use when computing the kernel bandwidth. The actual kernel size will be determined by multiplying the scale factor by the standard deviation of the data within each bin.
**cut** : float, optional
> Distance, in units of bandwidth size, to extend the density past the extreme datapoints. Set to 0 to limit the violin range within the range of the observed data (i.e., to have the same effect as `trim=True` in `ggplot`.
**scale** : {“area”, “count”, “width”}, optional
> The method used to scale the width of each violin. If `area`, each violin will have the same area. If `count`, the width of the violins will be scaled by the number of observations in that bin. If `width`, each violin will have the same width.
**scale_hue** : bool, optional
> When nesting violins using a `hue` variable, this parameter determines whether the scaling is computed within each level of the major grouping variable (`scale_hue=True`) or across all the violins on the plot (`scale_hue=False`).
**gridsize** : int, optional
> Number of points in the discrete grid used to compute the kernel density estimate.
**width** : float, optional
> Width of a full element when not using hue nesting, or width of all the elements for one level of the major grouping variable.
**inner** : {“box”, “quartile”, “point”, “stick”, None}, optional
> Representation of the datapoints in the violin interior. If `box`, draw a miniature boxplot. If `quartiles`, draw the quartiles of the distribution. If `point` or `stick`, show each underlying datapoint. Using `None` will draw unadorned violins.
**split** : bool, optional
> When using hue nesting with a variable that takes two levels, setting `split` to True will draw half of a violin for each level. This can make it easier to directly compare the distributions.
**dodge** : bool, optional
> When hue nesting is used, whether elements should be shifted along the categorical axis.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**linewidth** : float, optional
> Width of the gray lines that frame the plot elements.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**saturation** : float, optional
> Proportion of the original saturation to draw colors at. Large patches often look better with slightly desaturated colors, but set this to `1` if you want the plot colors to perfectly match the input color spec.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
A traditional box-and-whisker plot with a similar API.A scatterplot where one variable is categorical. Can be used in conjunction with other plots to show each observation.A categorical scatterplot where the points do not overlap. Can be used with other plots to show each observation.
Examples
Draw a single horizontal violinplot:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.violinplot(x=tips["total_bill"])
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-1.png](img/997c424ce3337d1c47dea839b9dbdcae.jpg)
Draw a vertical violinplot grouped by a categorical variable:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-2.png](img/35c303fe21899eb631a454ab2d09e1bf.jpg)
Draw a violinplot with nested grouping by two categorical variables:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="muted")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-3.png](img/518916184779b02556d17a4d7366ba4f.jpg)
Draw split violins to compare the across the hue variable:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="muted", split=True)
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-4.png](img/556be3cec3d1462768f0cc39618394ee.jpg)
Control violin order by passing an explicit order:
```py
>>> ax = sns.violinplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-5.png](img/0a27825dabd4d46b78291be90e8f255e.jpg)
Scale the violin width by the number of observations in each bin:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="sex",
... data=tips, palette="Set2", split=True,
... scale="count")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-6.png](img/827ec31007a6e721317dd1ef46a8602f.jpg)
Draw the quartiles as horizontal lines instead of a mini-box:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="sex",
... data=tips, palette="Set2", split=True,
... scale="count", inner="quartile")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-7.png](img/09cb7121a5be805931cc8ae1c99d3cf9.jpg)
Show each observation with a stick inside the violin:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="sex",
... data=tips, palette="Set2", split=True,
... scale="count", inner="stick")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-8.png](img/5c7220bdfc81c3823862c2988af57776.jpg)
Scale the density relative to the counts across all bins:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="sex",
... data=tips, palette="Set2", split=True,
... scale="count", inner="stick", scale_hue=False)
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-9.png](img/b8b693d813ee5778cb52a3f3f634fc11.jpg)
Use a narrow bandwidth to reduce the amount of smoothing:
```py
>>> ax = sns.violinplot(x="day", y="total_bill", hue="sex",
... data=tips, palette="Set2", split=True,
... scale="count", inner="stick",
... scale_hue=False, bw=.2)
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-10.png](img/a8ea9b9779973bf3274cc3f154bb6029.jpg)
Draw horizontal violins:
```py
>>> planets = sns.load_dataset("planets")
>>> ax = sns.violinplot(x="orbital_period", y="method",
... data=planets[planets.orbital_period < 1000],
... scale="width", palette="Set3")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-11.png](img/7a72774eb92deca2a76e6428021a5bd6.jpg)
Don’t let density extend past extreme values in the data:
```py
>>> ax = sns.violinplot(x="orbital_period", y="method",
... data=planets[planets.orbital_period < 1000],
... cut=0, scale="width", palette="Set3")
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-12.png](img/eb118f7308dc5e81aa3ed5b5524a1182.jpg)
Use `hue` without changing violin position or width:
```py
>>> tips["weekend"] = tips["day"].isin(["Sat", "Sun"])
>>> ax = sns.violinplot(x="day", y="total_bill", hue="weekend",
... data=tips, dodge=False)
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-13.png](img/fad2cab7c30663b1f48e1015ad10f310.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`violinplot()`](#seaborn.violinplot "seaborn.violinplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="violin", split=True,
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-violinplot-14.png](img/49227838b078bcd197f52cd3a7b01865.jpg)
\ No newline at end of file
# seaborn.boxenplot
```py
seaborn.boxenplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, width=0.8, dodge=True, k_depth='proportion', linewidth=None, scale='exponential', outlier_prop=None, ax=None, **kwargs)
```
Draw an enhanced box plot for larger datasets.
This style of plot was originally named a “letter value” plot because it shows a large number of quantiles that are defined as “letter values”. It is similar to a box plot in plotting a nonparametric representation of a distribution in which all features correspond to actual observations. By plotting more quantiles, it provides more information about the shape of the distribution, particularly in the tails. For a more extensive explanation, you can read the paper that introduced the plot:
[https://vita.had.co.nz/papers/letter-value-plot.html](https://vita.had.co.nz/papers/letter-value-plot.html)
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**saturation** : float, optional
> Proportion of the original saturation to draw colors at. Large patches often look better with slightly desaturated colors, but set this to `1` if you want the plot colors to perfectly match the input color spec.
**width** : float, optional
> Width of a full element when not using hue nesting, or width of all the elements for one level of the major grouping variable.
**dodge** : bool, optional
> When hue nesting is used, whether elements should be shifted along the categorical axis.
**k_depth** : “proportion” &#124; “tukey” &#124; “trustworthy”, optional
> The number of boxes, and by extension number of percentiles, to draw. All methods are detailed in Wickham’s paper. Each makes different assumptions about the number of outliers and leverages different statistical properties.
**linewidth** : float, optional
> Width of the gray lines that frame the plot elements.
**scale** : “linear” &#124; “exponential” &#124; “area”
> Method to use for the width of the letter value boxes. All give similar results visually. “linear” reduces the width by a constant linear factor, “exponential” uses the proportion of data not covered, “area” is proportional to the percentage of data covered.
**outlier_prop** : float, optional
> Proportion of data believed to be outliers. Used in conjunction with k_depth to determine the number of percentiles to draw. Defaults to 0.007 as a proportion of outliers. Should be in range [0, 1].
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed through to `plt.plot` and `plt.scatter` at draw time.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
A combination of boxplot and kernel density estimation.A traditional box-and-whisker plot with a similar API.
Examples
Draw a single horizontal boxen plot:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.boxenplot(x=tips["total_bill"])
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-1.png](img/ea7362d005109093ddfe7d7a0039a13e.jpg)
Draw a vertical boxen plot grouped by a categorical variable:
```py
>>> ax = sns.boxenplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-2.png](img/31c79f0cf22d453e10799da960e3e801.jpg)
Draw a letter value plot with nested grouping by two categorical variables:
```py
>>> ax = sns.boxenplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="Set3")
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-3.png](img/1db91ed8446afc825fa5bba21f1ef278.jpg)
Draw a boxen plot with nested grouping when some bins are empty:
```py
>>> ax = sns.boxenplot(x="day", y="total_bill", hue="time",
... data=tips, linewidth=2.5)
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-4.png](img/2e57af8b26439c244046ff7846601335.jpg)
Control box order by passing an explicit order:
```py
>>> ax = sns.boxenplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-5.png](img/e8fa81696195ce058546e429317075bc.jpg)
Draw a boxen plot for each numeric variable in a DataFrame:
```py
>>> iris = sns.load_dataset("iris")
>>> ax = sns.boxenplot(data=iris, orient="h", palette="Set2")
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-6.png](img/a9e939280daed8ec0712c8e6e6be78fb.jpg)
Use [`stripplot()`](seaborn.stripplot.html#seaborn.stripplot "seaborn.stripplot") to show the datapoints on top of the boxes:
```py
>>> ax = sns.boxenplot(x="day", y="total_bill", data=tips)
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips,
... size=4, jitter=True, color="gray")
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-7.png](img/fb3de8051b91bb0be2143717f96c0a7c.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine [`boxenplot()`](#seaborn.boxenplot "seaborn.boxenplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="boxen",
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-boxenplot-8.png](img/ef97d95b2084af9b8636c2514545289d.jpg)
\ No newline at end of file
# seaborn.pointplot
```py
seaborn.pointplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, estimator=<function mean>, ci=95, n_boot=1000, units=None, markers='o', linestyles='-', dodge=False, join=True, scale=1, orient=None, color=None, palette=None, errwidth=None, capsize=None, ax=None, **kwargs)
```
Show point estimates and confidence intervals using scatter plot glyphs.
A point plot represents an estimate of central tendency for a numeric variable by the position of scatter plot points and provides some indication of the uncertainty around that estimate using error bars.
Point plots can be more useful than bar plots for focusing comparisons between different levels of one or more categorical variables. They are particularly adept at showing interactions: how the relationship between levels of one categorical variable changes across levels of a second categorical variable. The lines that join each point from the same `hue` level allow interactions to be judged by differences in slope, which is easier for the eyes than comparing the heights of several groups of points or bars.
It is important to keep in mind that a point plot shows only the mean (or other estimator) value, but in many cases it may be more informative to show the distribution of values at each level of the categorical variables. In that case, other approaches such as a box or violin plot may be more appropriate.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**estimator** : callable that maps vector -&gt; scalar, optional
> Statistical function to estimate within each categorical bin.
**ci** : float or “sd” or None, optional
> Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations. If `None`, no bootstrapping will be performed, and error bars will not be drawn.
**n_boot** : int, optional
> Number of bootstrap iterations to use when computing confidence intervals.
**units** : name of variable in `data` or vector data, optional
> Identifier of sampling units, which will be used to perform a multilevel bootstrap and account for repeated measures design.
**markers** : string or list of strings, optional
> Markers to use for each of the `hue` levels.
**linestyles** : string or list of strings, optional
> Line styles to use for each of the `hue` levels.
**dodge** : bool or float, optional
> Amount to separate the points for each level of the `hue` variable along the categorical axis.
**join** : bool, optional
> If `True`, lines will be drawn between point estimates at the same `hue` level.
**scale** : float, optional
> Scale factor for the plot elements.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**errwidth** : float, optional
> Thickness of error bar lines (and caps).
**capsize** : float, optional
> Width of the “caps” on error bars.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
Show point estimates and confidence intervals using bars.Combine a categorical plot with a class:<cite>FacetGrid</cite>.
Examples
Draw a set of vertical point plots grouped by a categorical variable:
```py
>>> import seaborn as sns
>>> sns.set(style="darkgrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.pointplot(x="time", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-1.png](img/f5eb9519edb052868537ca9735f0f8df.jpg)
Draw a set of vertical points with nested grouping by a two variables:
```py
>>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
... data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-2.png](img/864eda3b3c2fcc6b0bdb53c84c3dafcf.jpg)
Separate the points for different hue levels along the categorical axis:
```py
>>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
... data=tips, dodge=True)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-3.png](img/b7f6772294dcf0d9b7035314c114c54b.jpg)
Use a different marker and line style for the hue levels:
```py
>>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
... data=tips,
... markers=["o", "x"],
... linestyles=["-", "--"])
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-4.png](img/a97ae4389fc8bc946eb62e06c173b3e3.jpg)
Draw a set of horizontal points:
```py
>>> ax = sns.pointplot(x="tip", y="day", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-5.png](img/4217fbfe6aaba42c4d18a69c5b8c9fc4.jpg)
Don’t draw a line connecting each point:
```py
>>> ax = sns.pointplot(x="tip", y="day", data=tips, join=False)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-6.png](img/96a33f32e85dcced62c9fc4ff063fe3d.jpg)
Use a different color for a single-layer plot:
```py
>>> ax = sns.pointplot("time", y="total_bill", data=tips,
... color="#bb3f3f")
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-7.png](img/1e3348f06e5cd7876d5bc530b04d3d93.jpg)
Use a different color palette for the points:
```py
>>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
... data=tips, palette="Set2")
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-8.png](img/d4a4eeea79c55b0ae9d3088746b6503a.jpg)
Control point order by passing an explicit order:
```py
>>> ax = sns.pointplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-9.png](img/4c08e24283b6829b3d91e3c23de56923.jpg)
Use median as the estimate of central tendency:
```py
>>> from numpy import median
>>> ax = sns.pointplot(x="day", y="tip", data=tips, estimator=median)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-10.png](img/0ec9398faa407996527db66db46c71f2.jpg)
Show the standard error of the mean with the error bars:
```py
>>> ax = sns.pointplot(x="day", y="tip", data=tips, ci=68)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-11.png](img/f9f6dd93a512624527b38dcc26d97e37.jpg)
Show standard deviation of observations instead of a confidence interval:
```py
>>> ax = sns.pointplot(x="day", y="tip", data=tips, ci="sd")
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-12.png](img/f41526e37f8f11614ea339da0e242c51.jpg)
Add “caps” to the error bars:
```py
>>> ax = sns.pointplot(x="day", y="tip", data=tips, capsize=.2)
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-13.png](img/b7df4cf62c681ea39bd145bdb740bc81.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`barplot()`](seaborn.barplot.html#seaborn.barplot "seaborn.barplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="point",
... dodge=True,
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-pointplot-14.png](img/2d47b5f96f08a539147e7f0a71d0aa33.jpg)
\ No newline at end of file
# Installing and getting started
To install the latest release of seaborn, you can use `pip`:
```py
pip install seaborn
```
It’s also possible to install the released version using `conda`:
```py
conda install seaborn
```
Alternatively, you can use `pip` to install the development version directly from github:
```py
pip install git+https://github.com/mwaskom/seaborn.git
```
Another option would be to to clone the [github repository](https://github.com/mwaskom/seaborn) and install from your local copy:
```py
pip install .
```
## Dependencies
* Python 2.7 or 3.5+
### Mandatory dependencies
* [numpy](http://www.numpy.org/) (&gt;= 1.9.3)
* [scipy](https://www.scipy.org/) (&gt;= 0.14.0)
* [matplotlib](https://matplotlib.org) (&gt;= 1.4.3)
* [pandas](https://pandas.pydata.org/) (&gt;= 0.15.2)
### Recommended dependencies
* [statsmodels](https://www.statsmodels.org/) (&gt;= 0.5.0)
## Testing
To test seaborn, run `make test` in the root directory of the source distribution. This runs the unit test suite (using `pytest`, but many older tests use `nose` asserts). It also runs the example code in function docstrings to smoke-test a broader and more realistic range of example usage.
The full set of tests requires an internet connection to download the example datasets (if they haven’t been previously cached), but the unit tests should be possible to run offline.
## Bugs
Please report any bugs you encounter through the github [issue tracker](https://github.com/mwaskom/seaborn/issues/new). It will be most helpful to include a reproducible example on one of the example datasets (accessed through [`load_dataset()`](generated/seaborn.load_dataset.html#seaborn.load_dataset "seaborn.load_dataset")). It is difficult debug any issues without knowing the versions of seaborn and matplotlib you are using, as well as what [matplotlib backend](https://matplotlib.org/faq/usage_faq.html#what-is-a-backend) you are using to draw the plots, so please include those in your bug report.
\ No newline at end of file
# seaborn.barplot
```py
seaborn.barplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, estimator=<function mean>, ci=95, n_boot=1000, units=None, orient=None, color=None, palette=None, saturation=0.75, errcolor='.26', errwidth=None, capsize=None, dodge=True, ax=None, **kwargs)
```
Show point estimates and confidence intervals as rectangular bars.
A bar plot represents an estimate of central tendency for a numeric variable with the height of each rectangle and provides some indication of the uncertainty around that estimate using error bars. Bar plots include 0 in the quantitative axis range, and they are a good choice when 0 is a meaningful value for the quantitative variable, and you want to make comparisons against it.
For datasets where 0 is not a meaningful value, a point plot will allow you to focus on differences between levels of one or more categorical variables.
It is also important to keep in mind that a bar plot shows only the mean (or other estimator) value, but in many cases it may be more informative to show the distribution of values at each level of the categorical variables. In that case, other approaches such as a box or violin plot may be more appropriate.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**estimator** : callable that maps vector -&gt; scalar, optional
> Statistical function to estimate within each categorical bin.
**ci** : float or “sd” or None, optional
> Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations. If `None`, no bootstrapping will be performed, and error bars will not be drawn.
**n_boot** : int, optional
> Number of bootstrap iterations to use when computing confidence intervals.
**units** : name of variable in `data` or vector data, optional
> Identifier of sampling units, which will be used to perform a multilevel bootstrap and account for repeated measures design.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**saturation** : float, optional
> Proportion of the original saturation to draw colors at. Large patches often look better with slightly desaturated colors, but set this to `1` if you want the plot colors to perfectly match the input color spec.
**errcolor** : matplotlib color
> Color for the lines that represent the confidence interval.
**errwidth** : float, optional
> Thickness of error bar lines (and caps).
**capsize** : float, optional
> Width of the “caps” on error bars.
**dodge** : bool, optional
> When hue nesting is used, whether elements should be shifted along the categorical axis.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed through to `plt.bar` at draw time.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
Show the counts of observations in each categorical bin.Show point estimates and confidence intervals using scatterplot glyphs.Combine a categorical plot with a class:<cite>FacetGrid</cite>.
Examples
Draw a set of vertical bar plots grouped by a categorical variable:
```py
>>> import seaborn as sns
>>> sns.set(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.barplot(x="day", y="total_bill", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-1.png](img/9d1addc98b6a35ef0376219c56e7b7fd.jpg)
Draw a set of vertical bars with nested grouping by a two variables:
```py
>>> ax = sns.barplot(x="day", y="total_bill", hue="sex", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-2.png](img/863249efe2403afa4fae2f2b6884d3bd.jpg)
Draw a set of horizontal bars:
```py
>>> ax = sns.barplot(x="tip", y="day", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-3.png](img/c3ea6265eaff0a4bfaec2966088cb66f.jpg)
Control bar order by passing an explicit order:
```py
>>> ax = sns.barplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
```
![http://seaborn.pydata.org/_images/seaborn-barplot-4.png](img/9233554272a5e436f6ab85c97a65010c.jpg)
Use median as the estimate of central tendency:
```py
>>> from numpy import median
>>> ax = sns.barplot(x="day", y="tip", data=tips, estimator=median)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-5.png](img/2622373fb99932aa42e45c3b151135be.jpg)
Show the standard error of the mean with the error bars:
```py
>>> ax = sns.barplot(x="day", y="tip", data=tips, ci=68)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-6.png](img/d1310bd7e87a8549d1f0b3a1479fc06d.jpg)
Show standard deviation of observations instead of a confidence interval:
```py
>>> ax = sns.barplot(x="day", y="tip", data=tips, ci="sd")
```
![http://seaborn.pydata.org/_images/seaborn-barplot-7.png](img/eeb77dac6d8f76d9f715476ce03773c5.jpg)
Add “caps” to the error bars:
```py
>>> ax = sns.barplot(x="day", y="tip", data=tips, capsize=.2)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-8.png](img/5a69e1058d9b8b4b5be6dc15d1bad130.jpg)
Use a different color palette for the bars:
```py
>>> ax = sns.barplot("size", y="total_bill", data=tips,
... palette="Blues_d")
```
![http://seaborn.pydata.org/_images/seaborn-barplot-9.png](img/ef011fca38d3c55dde21ee8363e93e61.jpg)
Use `hue` without changing bar position or width:
```py
>>> tips["weekend"] = tips["day"].isin(["Sat", "Sun"])
>>> ax = sns.barplot(x="day", y="total_bill", hue="weekend",
... data=tips, dodge=False)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-10.png](img/d38d4ad12b16322a5ed00690bcbcd8b6.jpg)
Plot all bars in a single color:
```py
>>> ax = sns.barplot("size", y="total_bill", data=tips,
... color="salmon", saturation=.5)
```
![http://seaborn.pydata.org/_images/seaborn-barplot-11.png](img/4922c693b75b7656b2f16f8fd2dd6509.jpg)
Use `plt.bar` keyword arguments to further change the aesthetic:
```py
>>> ax = sns.barplot("day", "total_bill", data=tips,
... linewidth=2.5, facecolor=(1, 1, 1, 0),
... errcolor=".2", edgecolor=".2")
```
![http://seaborn.pydata.org/_images/seaborn-barplot-12.png](img/20114eb58ca40a3ccf0b20f14f426c83.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`barplot()`](#seaborn.barplot "seaborn.barplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="bar",
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-barplot-13.png](img/a2d8b9c6867b1006b56e5508d5472c86.jpg)
\ No newline at end of file
# seaborn.countplot
```py
seaborn.countplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, dodge=True, ax=None, **kwargs)
```
Show the counts of observations in each categorical bin using bars.
A count plot can be thought of as a histogram across a categorical, instead of quantitative, variable. The basic API and options are identical to those for [`barplot()`](seaborn.barplot.html#seaborn.barplot "seaborn.barplot"), so you can compare counts across nested variables.
Input data can be passed in a variety of formats, including:
* Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the `x`, `y`, and/or `hue` parameters.
* A “long-form” DataFrame, in which case the `x`, `y`, and `hue` variables will determine how the data are plotted.
* A “wide-form” DataFrame, such that each numeric column will be plotted.
* An array or list of vectors.
In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.
See the [tutorial](../tutorial/categorical.html#categorical-tutorial) for more information.
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation.
**data** : DataFrame, array, or list of arrays, optional
> Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional
> Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
**orient** : “v” &#124; “h”, optional
> Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.
**color** : matplotlib color, optional
> Color for all of the elements, or seed for a gradient palette.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**saturation** : float, optional
> Proportion of the original saturation to draw colors at. Large patches often look better with slightly desaturated colors, but set this to `1` if you want the plot colors to perfectly match the input color spec.
**dodge** : bool, optional
> When hue nesting is used, whether elements should be shifted along the categorical axis.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
**kwargs** : key, value mappings
> Other keyword arguments are passed to `plt.bar`.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot drawn onto it.
|
| --- | --- |
See also
Show point estimates and confidence intervals using bars.Combine a categorical plot with a class:<cite>FacetGrid</cite>.
Examples
Show value counts for a single categorical variable:
```py
>>> import seaborn as sns
>>> sns.set(style="darkgrid")
>>> titanic = sns.load_dataset("titanic")
>>> ax = sns.countplot(x="class", data=titanic)
```
![http://seaborn.pydata.org/_images/seaborn-countplot-1.png](img/840a3b4206930d48fae0f0d4549b87a0.jpg)
Show value counts for two categorical variables:
```py
>>> ax = sns.countplot(x="class", hue="who", data=titanic)
```
![http://seaborn.pydata.org/_images/seaborn-countplot-2.png](img/7fde400b120a0b6cd6aca0cb2de690db.jpg)
Plot the bars horizontally:
```py
>>> ax = sns.countplot(y="class", hue="who", data=titanic)
```
![http://seaborn.pydata.org/_images/seaborn-countplot-3.png](img/512afaa1b09caf55faf909a34995137a.jpg)
Use a different color palette:
```py
>>> ax = sns.countplot(x="who", data=titanic, palette="Set3")
```
![http://seaborn.pydata.org/_images/seaborn-countplot-4.png](img/d3ac1e2e1f590489ef76341664562f87.jpg)
Use `plt.bar` keyword arguments for a different look:
```py
>>> ax = sns.countplot(x="who", data=titanic,
... facecolor=(0, 0, 0, 0),
... linewidth=5,
... edgecolor=sns.color_palette("dark", 3))
```
![http://seaborn.pydata.org/_images/seaborn-countplot-5.png](img/d23d0851c88c12754e0c1e08aac20d01.jpg)
Use [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") to combine a [`countplot()`](#seaborn.countplot "seaborn.countplot") and a [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). This allows grouping within additional categorical variables. Using [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") is safer than using [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") directly, as it ensures synchronization of variable order across facets:
```py
>>> g = sns.catplot(x="class", hue="who", col="survived",
... data=titanic, kind="count",
... height=4, aspect=.7);
```
![http://seaborn.pydata.org/_images/seaborn-countplot-6.png](img/5d75285f3c08542cd9db2296ef737d54.jpg)
\ No newline at end of file
# seaborn.jointplot
```py
seaborn.jointplot(x, y, data=None, kind='scatter', stat_func=None, color=None, height=6, ratio=5, space=0.2, dropna=True, xlim=None, ylim=None, joint_kws=None, marginal_kws=None, annot_kws=None, **kwargs)
```
Draw a plot of two variables with bivariate and univariate graphs.
This function provides a convenient interface to the [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid") class, with several canned plot kinds. This is intended to be a fairly lightweight wrapper; if you need more flexibility, you should use [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid") directly.
| Parameters: | **x, y** : strings or vectors
> Data or names of variables in `data`.
**data** : DataFrame, optional
> DataFrame when `x` and `y` are variable names.
**kind** : { “scatter” &#124; “reg” &#124; “resid” &#124; “kde” &#124; “hex” }, optional
> Kind of plot to draw.
**stat_func** : callable or None, optional
> _Deprecated_
**color** : matplotlib color, optional
> Color used for the plot elements.
**height** : numeric, optional
> Size of the figure (it will be square).
**ratio** : numeric, optional
> Ratio of joint axes height to marginal axes height.
**space** : numeric, optional
> Space between the joint and marginal axes
**dropna** : bool, optional
> If True, remove observations that are missing from `x` and `y`.
**{x, y}lim** : two-tuples, optional
> Axis limits to set before plotting.
**{joint, marginal, annot}_kws** : dicts, optional
> Additional keyword arguments for the plot components.
**kwargs** : key, value pairings
> Additional keyword arguments are passed to the function used to draw the plot on the joint Axes, superseding items in the `joint_kws` dictionary.
|
| --- | --- |
| Returns: | **grid** : [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid")
> [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid") object with the plot on it.
|
| --- | --- |
See also
The Grid class used for drawing this plot. Use it directly if you need more flexibility.
Examples
Draw a scatterplot with marginal histograms:
```py
>>> import numpy as np, pandas as pd; np.random.seed(0)
>>> import seaborn as sns; sns.set(style="white", color_codes=True)
>>> tips = sns.load_dataset("tips")
>>> g = sns.jointplot(x="total_bill", y="tip", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-1.png](img/48d5020fcbaa6d2f36aae520f84a6234.jpg)
Add regression and kernel density fits:
```py
>>> g = sns.jointplot("total_bill", "tip", data=tips, kind="reg")
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-2.png](img/8434c101b75c73a9e1b8dfb89975a2b5.jpg)
Replace the scatterplot with a joint histogram using hexagonal bins:
```py
>>> g = sns.jointplot("total_bill", "tip", data=tips, kind="hex")
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-3.png](img/6d5c569bf97b1f683a2ec921e1031112.jpg)
Replace the scatterplots and histograms with density estimates and align the marginal Axes tightly with the joint Axes:
```py
>>> iris = sns.load_dataset("iris")
>>> g = sns.jointplot("sepal_width", "petal_length", data=iris,
... kind="kde", space=0, color="g")
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-4.png](img/c2c70e8889861b837b4fd45d707a6616.jpg)
Draw a scatterplot, then add a joint density estimate:
```py
>>> g = (sns.jointplot("sepal_length", "sepal_width",
... data=iris, color="k")
... .plot_joint(sns.kdeplot, zorder=0, n_levels=6))
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-5.png](img/b6895c87c4fa5a7fa1dc151dc3e5b385.jpg)
Pass vectors in directly without using Pandas, then name the axes:
```py
>>> x, y = np.random.randn(2, 300)
>>> g = (sns.jointplot(x, y, kind="hex")
... .set_axis_labels("x", "y"))
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-6.png](img/72b1f526c884ba4a6a285f1e8723013e.jpg)
Draw a smaller figure with more space devoted to the marginal plots:
```py
>>> g = sns.jointplot("total_bill", "tip", data=tips,
... height=5, ratio=3, color="g")
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-7.png](img/ddcf0a83320e56c75f2d5d15ff29c874.jpg)
Pass keyword arguments down to the underlying plots:
```py
>>> g = sns.jointplot("petal_length", "sepal_length", data=iris,
... marginal_kws=dict(bins=15, rug=True),
... annot_kws=dict(stat="r"),
... s=40, edgecolor="w", linewidth=1)
```
![http://seaborn.pydata.org/_images/seaborn-jointplot-8.png](img/0fa41716b87d635876d921fc9ab967ea.jpg)
\ No newline at end of file
# seaborn.pairplot
```py
seaborn.pairplot(data, hue=None, hue_order=None, palette=None, vars=None, x_vars=None, y_vars=None, kind='scatter', diag_kind='auto', markers=None, height=2.5, aspect=1, dropna=True, plot_kws=None, diag_kws=None, grid_kws=None, size=None)
```
Plot pairwise relationships in a dataset.
By default, this function will create a grid of Axes such that each variable in `data` will by shared in the y-axis across a single row and in the x-axis across a single column. The diagonal Axes are treated differently, drawing a plot to show the univariate distribution of the data for the variable in that column.
It is also possible to show a subset of variables or plot different variables on the rows and columns.
This is a high-level interface for [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") that is intended to make it easy to draw a few common styles. You should use [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") directly if you need more flexibility.
| Parameters: | **data** : DataFrame
> Tidy (long-form) dataframe where each column is a variable and each row is an observation.
**hue** : string (variable name), optional
> Variable in `data` to map plot aspects to different colors.
**hue_order** : list of strings
> Order for the levels of the hue variable in the palette
**palette** : dict or seaborn color palette
> Set of colors for mapping the `hue` variable. If a dict, keys should be values in the `hue` variable.
**vars** : list of variable names, optional
> Variables within `data` to use, otherwise use every column with a numeric datatype.
**{x, y}_vars** : lists of variable names, optional
> Variables within `data` to use separately for the rows and columns of the figure; i.e. to make a non-square plot.
**kind** : {‘scatter’, ‘reg’}, optional
> Kind of plot for the non-identity relationships.
**diag_kind** : {‘auto’, ‘hist’, ‘kde’}, optional
> Kind of plot for the diagonal subplots. The default depends on whether `"hue"` is used or not.
**markers** : single matplotlib marker code or list, optional
> Either the marker to use for all datapoints or a list of markers with a length the same as the number of levels in the hue variable so that differently colored points will also have different scatterplot markers.
**height** : scalar, optional
> Height (in inches) of each facet.
**aspect** : scalar, optional
> Aspect * height gives the width (in inches) of each facet.
**dropna** : boolean, optional
> Drop missing values from the data before plotting.
**{plot, diag, grid}_kws** : dicts, optional
> Dictionaries of keyword arguments.
|
| --- | --- |
| Returns: | **grid** : PairGrid
> Returns the underlying `PairGrid` instance for further tweaking.
|
| --- | --- |
See also
Subplot grid for more flexible plotting of pairwise relationships.
Examples
Draw scatterplots for joint relationships and histograms for univariate distributions:
```py
>>> import seaborn as sns; sns.set(style="ticks", color_codes=True)
>>> iris = sns.load_dataset("iris")
>>> g = sns.pairplot(iris)
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-1.png](img/712c7f2cff4ed2c31b99bf5200838ae1.jpg)
Show different levels of a categorical variable by the color of plot elements:
```py
>>> g = sns.pairplot(iris, hue="species")
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-2.png](img/98c1e58e7427e940294084d2b4582ac8.jpg)
Use a different color palette:
```py
>>> g = sns.pairplot(iris, hue="species", palette="husl")
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-3.png](img/f6d3d4030bc93eefcb054749cf90c36b.jpg)
Use different markers for each level of the hue variable:
```py
>>> g = sns.pairplot(iris, hue="species", markers=["o", "s", "D"])
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-4.png](img/6840daa5bd6d421f05969aeb76c74032.jpg)
Plot a subset of variables:
```py
>>> g = sns.pairplot(iris, vars=["sepal_width", "sepal_length"])
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-5.png](img/87b11c84b7ec8551c2edf9a2ef987014.jpg)
Draw larger plots:
```py
>>> g = sns.pairplot(iris, height=3,
... vars=["sepal_width", "sepal_length"])
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-6.png](img/5e89b880399cf894d124b590416e7fb5.jpg)
Plot different variables in the rows and columns:
```py
>>> g = sns.pairplot(iris,
... x_vars=["sepal_width", "sepal_length"],
... y_vars=["petal_width", "petal_length"])
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-7.png](img/35f33d0939e4e10f46437f5690ad766b.jpg)
Use kernel density estimates for univariate plots:
```py
>>> g = sns.pairplot(iris, diag_kind="kde")
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-8.png](img/cc2c3fb8414e50f2d9f95ab073457c23.jpg)
Fit linear regression models to the scatter plots:
```py
>>> g = sns.pairplot(iris, kind="reg")
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-9.png](img/74befbc8e8cbc89474dd845fb49329ca.jpg)
Pass keyword arguments down to the underlying functions (it may be easier to use [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") directly):
```py
>>> g = sns.pairplot(iris, diag_kind="kde", markers="+",
... plot_kws=dict(s=50, edgecolor="b", linewidth=1),
... diag_kws=dict(shade=True))
```
![http://seaborn.pydata.org/_images/seaborn-pairplot-10.png](img/0b688ef9f59240384ca84839d9707ce7.jpg)
\ No newline at end of file
# seaborn.distplot
```py
seaborn.distplot(a, bins=None, hist=True, kde=True, rug=False, fit=None, hist_kws=None, kde_kws=None, rug_kws=None, fit_kws=None, color=None, vertical=False, norm_hist=False, axlabel=None, label=None, ax=None)
```
Flexibly plot a univariate distribution of observations.
This function combines the matplotlib `hist` function (with automatic calculation of a good default bin size) with the seaborn [`kdeplot()`](seaborn.kdeplot.html#seaborn.kdeplot "seaborn.kdeplot") and [`rugplot()`](seaborn.rugplot.html#seaborn.rugplot "seaborn.rugplot") functions. It can also fit `scipy.stats` distributions and plot the estimated PDF over the data.
| Parameters: | **a** : Series, 1d-array, or list.
> Observed data. If this is a Series object with a `name` attribute, the name will be used to label the data axis.
**bins** : argument for matplotlib hist(), or None, optional
> Specification of hist bins, or None to use Freedman-Diaconis rule.
**hist** : bool, optional
> Whether to plot a (normed) histogram.
**kde** : bool, optional
> Whether to plot a gaussian kernel density estimate.
**rug** : bool, optional
> Whether to draw a rugplot on the support axis.
**fit** : random variable object, optional
> An object with &lt;cite&gt;fit&lt;/cite&gt; method, returning a tuple that can be passed to a &lt;cite&gt;pdf&lt;/cite&gt; method a positional arguments following an grid of values to evaluate the pdf on.
**{hist, kde, rug, fit}_kws** : dictionaries, optional
> Keyword arguments for underlying plotting functions.
**color** : matplotlib color, optional
> Color to plot everything but the fitted curve in.
**vertical** : bool, optional
> If True, observed values are on y-axis.
**norm_hist** : bool, optional
> If True, the histogram height shows a density rather than a count. This is implied if a KDE or fitted density is plotted.
**axlabel** : string, False, or None, optional
> Name for the support axis label. If None, will try to get it from a.namel if False, do not set a label.
**label** : string, optional
> Legend label for the relevent component of the plot
**ax** : matplotlib axis, optional
> if provided, plot on this axis
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Returns the Axes object with the plot for further tweaking.
|
| --- | --- |
See also
Show a univariate or bivariate distribution with a kernel density estimate.Draw small vertical lines to show each observation in a distribution.
Examples
Show a default plot with a kernel density estimate and histogram with bin size determined automatically with a reference rule:
```py
>>> import seaborn as sns, numpy as np
>>> sns.set(); np.random.seed(0)
>>> x = np.random.randn(100)
>>> ax = sns.distplot(x)
```
![http://seaborn.pydata.org/_images/seaborn-distplot-1.png](img/dfbc2ec93ea21c479448cd2e25976945.jpg)
Use Pandas objects to get an informative axis label:
```py
>>> import pandas as pd
>>> x = pd.Series(x, name="x variable")
>>> ax = sns.distplot(x)
```
![http://seaborn.pydata.org/_images/seaborn-distplot-2.png](img/d33f6bf00c0886595c68d970316b0717.jpg)
Plot the distribution with a kernel density estimate and rug plot:
```py
>>> ax = sns.distplot(x, rug=True, hist=False)
```
![http://seaborn.pydata.org/_images/seaborn-distplot-3.png](img/85548cb1190d0ad63fbaf33d0966b16d.jpg)
Plot the distribution with a histogram and maximum likelihood gaussian distribution fit:
```py
>>> from scipy.stats import norm
>>> ax = sns.distplot(x, fit=norm, kde=False)
```
![http://seaborn.pydata.org/_images/seaborn-distplot-4.png](img/d3a9c4026d4ce70e54b250057cd2062b.jpg)
Plot the distribution on the vertical axis:
```py
>>> ax = sns.distplot(x, vertical=True)
```
![http://seaborn.pydata.org/_images/seaborn-distplot-5.png](img/0a53d5e52e4ce61295a6c2b5fc4bf6c8.jpg)
Change the color of all the plot elements:
```py
>>> sns.set_color_codes()
>>> ax = sns.distplot(x, color="y")
```
![http://seaborn.pydata.org/_images/seaborn-distplot-6.png](img/fac6ba03c6573e299e4eee00c32999fb.jpg)
Pass specific parameters to the underlying plot functions:
```py
>>> ax = sns.distplot(x, rug=True, rug_kws={"color": "g"},
... kde_kws={"color": "k", "lw": 3, "label": "KDE"},
... hist_kws={"histtype": "step", "linewidth": 3,
... "alpha": 1, "color": "g"})
```
![http://seaborn.pydata.org/_images/seaborn-distplot-7.png](img/fce8e5a984297be3f6f8b5d4c5369a78.jpg)
\ No newline at end of file
# seaborn.kdeplot
```py
seaborn.kdeplot(data, data2=None, shade=False, vertical=False, kernel='gau', bw='scott', gridsize=100, cut=3, clip=None, legend=True, cumulative=False, shade_lowest=True, cbar=False, cbar_ax=None, cbar_kws=None, ax=None, **kwargs)
```
Fit and plot a univariate or bivariate kernel density estimate.
| Parameters: | **data** : 1d array-like
> Input data.
**data2: 1d array-like, optional**
> Second input data. If present, a bivariate KDE will be estimated.
**shade** : bool, optional
> If True, shade in the area under the KDE curve (or draw with filled contours when data is bivariate).
**vertical** : bool, optional
> If True, density is on x-axis.
**kernel** : {‘gau’ &#124; ‘cos’ &#124; ‘biw’ &#124; ‘epa’ &#124; ‘tri’ &#124; ‘triw’ }, optional
> Code for shape of kernel to fit with. Bivariate KDE can only use gaussian kernel.
**bw** : {‘scott’ &#124; ‘silverman’ &#124; scalar &#124; pair of scalars }, optional
> Name of reference method to determine kernel size, scalar factor, or scalar for each dimension of the bivariate plot. Note that the underlying computational libraries have different interperetations for this parameter: `statsmodels` uses it directly, but `scipy` treats it as a scaling factor for the standard deviation of the data.
**gridsize** : int, optional
> Number of discrete points in the evaluation grid.
**cut** : scalar, optional
> Draw the estimate to cut * bw from the extreme data points.
**clip** : pair of scalars, or pair of pair of scalars, optional
> Lower and upper bounds for datapoints used to fit KDE. Can provide a pair of (low, high) bounds for bivariate plots.
**legend** : bool, optional
> If True, add a legend or label the axes when possible.
**cumulative** : bool, optional
> If True, draw the cumulative distribution estimated by the kde.
**shade_lowest** : bool, optional
> If True, shade the lowest contour of a bivariate KDE plot. Not relevant when drawing a univariate plot or when `shade=False`. Setting this to `False` can be useful when you want multiple densities on the same Axes.
**cbar** : bool, optional
> If True and drawing a bivariate KDE plot, add a colorbar.
**cbar_ax** : matplotlib axes, optional
> Existing axes to draw the colorbar onto, otherwise space is taken from the main axes.
**cbar_kws** : dict, optional
> Keyword arguments for `fig.colorbar()`.
**ax** : matplotlib axes, optional
> Axes to plot on, otherwise uses current axes.
**kwargs** : key, value pairings
> Other keyword arguments are passed to `plt.plot()` or `plt.contour{f}` depending on whether a univariate or bivariate plot is being drawn.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Axes with plot.
|
| --- | --- |
See also
Flexibly plot a univariate distribution of observations.Plot a joint dataset with bivariate and marginal distributions.
Examples
Plot a basic univariate density:
```py
>>> import numpy as np; np.random.seed(10)
>>> import seaborn as sns; sns.set(color_codes=True)
>>> mean, cov = [0, 2], [(1, .5), (.5, 1)]
>>> x, y = np.random.multivariate_normal(mean, cov, size=50).T
>>> ax = sns.kdeplot(x)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-1.png](img/467839dfd41d95bdf1eb6d992d54a81f.jpg)
Shade under the density curve and use a different color:
```py
>>> ax = sns.kdeplot(x, shade=True, color="r")
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-2.png](img/98bd4d30d5719cd930a50603d08aa30e.jpg)
Plot a bivariate density:
```py
>>> ax = sns.kdeplot(x, y)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-3.png](img/1a4a764cf63a098fe9db3dc317e88058.jpg)
Use filled contours:
```py
>>> ax = sns.kdeplot(x, y, shade=True)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-4.png](img/566a36de7b39f66e34fa323e7153fa42.jpg)
Use more contour levels and a different color palette:
```py
>>> ax = sns.kdeplot(x, y, n_levels=30, cmap="Purples_d")
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-5.png](img/73c68c911f3d8aaf827238e97a8dc560.jpg)
Use a narrower bandwith:
```py
>>> ax = sns.kdeplot(x, bw=.15)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-6.png](img/cf85bc1dbfbb0399b3008f079b88d570.jpg)
Plot the density on the vertical axis:
```py
>>> ax = sns.kdeplot(y, vertical=True)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-7.png](img/62b886998fa52840a228f283aa862506.jpg)
Limit the density curve within the range of the data:
```py
>>> ax = sns.kdeplot(x, cut=0)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-8.png](img/1d21f3969de9de67e8acd0e2486c5e04.jpg)
Add a colorbar for the contours:
```py
>>> ax = sns.kdeplot(x, y, cbar=True)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-9.png](img/341dd0f98ddca59219e6289b038c8784.jpg)
Plot two shaded bivariate densities:
```py
>>> iris = sns.load_dataset("iris")
>>> setosa = iris.loc[iris.species == "setosa"]
>>> virginica = iris.loc[iris.species == "virginica"]
>>> ax = sns.kdeplot(setosa.sepal_width, setosa.sepal_length,
... cmap="Reds", shade=True, shade_lowest=False)
>>> ax = sns.kdeplot(virginica.sepal_width, virginica.sepal_length,
... cmap="Blues", shade=True, shade_lowest=False)
```
![http://seaborn.pydata.org/_images/seaborn-kdeplot-10.png](img/6ffe5e9bcaba45c14f423cae61e6e743.jpg)
\ No newline at end of file
# seaborn.rugplot
```py
seaborn.rugplot(a, height=0.05, axis='x', ax=None, **kwargs)
```
Plot datapoints in an array as sticks on an axis.
| Parameters: | **a** : vector
> 1D array of observations.
**height** : scalar, optional
> Height of ticks as proportion of the axis.
**axis** : {‘x’ &#124; ‘y’}, optional
> Axis to draw rugplot on.
**ax** : matplotlib axes, optional
> Axes to draw plot into; otherwise grabs current axes.
**kwargs** : key, value pairings
> Other keyword arguments are passed to `LineCollection`.
|
| --- | --- |
| Returns: | **ax** : matplotlib axes
> The Axes object with the plot on it.
|
| --- | --- |
\ No newline at end of file
# seaborn.lmplot
```py
seaborn.lmplot(x, y, data, hue=None, col=None, row=None, palette=None, col_wrap=None, height=5, aspect=1, markers='o', sharex=True, sharey=True, hue_order=None, col_order=None, row_order=None, legend=True, legend_out=True, x_estimator=None, x_bins=None, x_ci='ci', scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None, order=1, logistic=False, lowess=False, robust=False, logx=False, x_partial=None, y_partial=None, truncate=False, x_jitter=None, y_jitter=None, scatter_kws=None, line_kws=None, size=None)
```
Plot data and regression model fits across a FacetGrid.
This function combines [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") and [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). It is intended as a convenient interface to fit regression models across conditional subsets of a dataset.
When thinking about how to assign variables to different facets, a general rule is that it makes sense to use `hue` for the most important comparison, followed by `col` and `row`. However, always think about your particular dataset and the goals of the visualization you are creating.
There are a number of mutually exclusive options for estimating the regression model. See the [tutorial](../tutorial/regression.html#regression-tutorial) for more information.
The parameters to this function span most of the options in [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"), although there may be occasional cases where you will want to use that class and [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") directly.
| Parameters: | **x, y** : strings, optional
> Input variables; these should be column names in `data`.
**data** : DataFrame
> Tidy (“long-form”) dataframe where each column is a variable and each row is an observation.
**hue, col, row** : strings
> Variables that define subsets of the data, which will be drawn on separate facets in the grid. See the `*_order` parameters to control the order of levels of this variable.
**palette** : palette name, list, or dict, optional
> Colors to use for the different levels of the `hue` variable. Should be something that can be interpreted by [`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"), or a dictionary mapping hue levels to matplotlib colors.
**col_wrap** : int, optional
> “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a `row` facet.
**height** : scalar, optional
> Height (in inches) of each facet. See also: `aspect`.
**aspect** : scalar, optional
> Aspect ratio of each facet, so that `aspect * height` gives the width of each facet in inches.
**markers** : matplotlib marker code or list of marker codes, optional
> Markers for the scatterplot. If a list, each marker in the list will be used for each level of the `hue` variable.
**share{x,y}** : bool, ‘col’, or ‘row’ optional
> If true, the facets will share y axes across columns and/or x axes across rows.
**{hue,col,row}_order** : lists, optional
> Order for the levels of the faceting variables. By default, this will be the order that the levels appear in `data` or, if the variables are pandas categoricals, the category order.
**legend** : bool, optional
> If `True` and there is a `hue` variable, add a legend.
**legend_out** : bool, optional
> If `True`, the figure size will be extended, and the legend will be drawn outside the plot on the center right.
**x_estimator** : callable that maps vector -&gt; scalar, optional
> Apply this function to each unique value of `x` and plot the resulting estimate. This is useful when `x` is a discrete variable. If `x_ci` is given, this estimate will be bootstrapped and a confidence interval will be drawn.
**x_bins** : int or vector, optional
> Bin the `x` variable into discrete bins and then estimate the central tendency and a confidence interval. This binning only influences how the scatterplot is drawn; the regression is still fit to the original data. This parameter is interpreted either as the number of evenly-sized (not necessary spaced) bins or the positions of the bin centers. When this parameter is used, it implies that the default of `x_estimator` is `numpy.mean`.
**x_ci** : “ci”, “sd”, int in [0, 100] or None, optional
> Size of the confidence interval used when plotting a central tendency for discrete values of `x`. If `"ci"`, defer to the value of the `ci` parameter. If `"sd"`, skip bootstrapping and show the standard deviation of the observations in each bin.
**scatter** : bool, optional
> If `True`, draw a scatterplot with the underlying observations (or the `x_estimator` values).
**fit_reg** : bool, optional
> If `True`, estimate and plot a regression model relating the `x` and `y` variables.
**ci** : int in [0, 100] or None, optional
> Size of the confidence interval for the regression estimate. This will be drawn using translucent bands around the regression line. The confidence interval is estimated using a bootstrap; for large datasets, it may be advisable to avoid that computation by setting this parameter to None.
**n_boot** : int, optional
> Number of bootstrap resamples used to estimate the `ci`. The default value attempts to balance time and stability; you may want to increase this value for “final” versions of plots.
**units** : variable name in `data`, optional
> If the `x` and `y` observations are nested within sampling units, those can be specified here. This will be taken into account when computing the confidence intervals by performing a multilevel bootstrap that resamples both units and observations (within unit). This does not otherwise influence how the regression is estimated or drawn.
**order** : int, optional
> If `order` is greater than 1, use `numpy.polyfit` to estimate a polynomial regression.
**logistic** : bool, optional
> If `True`, assume that `y` is a binary variable and use `statsmodels` to estimate a logistic regression model. Note that this is substantially more computationally intensive than linear regression, so you may wish to decrease the number of bootstrap resamples (`n_boot`) or set `ci` to None.
**lowess** : bool, optional
> If `True`, use `statsmodels` to estimate a nonparametric lowess model (locally weighted linear regression). Note that confidence intervals cannot currently be drawn for this kind of model.
**robust** : bool, optional
> If `True`, use `statsmodels` to estimate a robust regression. This will de-weight outliers. Note that this is substantially more computationally intensive than standard linear regression, so you may wish to decrease the number of bootstrap resamples (`n_boot`) or set `ci` to None.
**logx** : bool, optional
> If `True`, estimate a linear regression of the form y ~ log(x), but plot the scatterplot and regression model in the input space. Note that `x` must be positive for this to work.
**{x,y}_partial** : strings in `data` or matrices
> Confounding variables to regress out of the `x` or `y` variables before plotting.
**truncate** : bool, optional
> By default, the regression line is drawn to fill the x axis limits after the scatterplot is drawn. If `truncate` is `True`, it will instead by bounded by the data limits.
**{x,y}_jitter** : floats, optional
> Add uniform random noise of this size to either the `x` or `y` variables. The noise is added to a copy of the data after fitting the regression, and only influences the look of the scatterplot. This can be helpful when plotting variables that take discrete values.
**{scatter,line}_kws** : dictionaries
> Additional keyword arguments to pass to `plt.scatter` and `plt.plot`.
|
| --- | --- |
See also
Plot data and a conditional model fit.Subplot grid for plotting conditional relationships.Combine [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") and [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") (when used with `kind="reg"`).
Notes
The [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") and [`lmplot()`](#seaborn.lmplot "seaborn.lmplot") functions are closely related, but the former is an axes-level function while the latter is a figure-level function that combines [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") and [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid").
Examples
These examples focus on basic regression model plots to exhibit the various faceting options; see the [`regplot()`](seaborn.regplot.html#seaborn.regplot "seaborn.regplot") docs for demonstrations of the other options for plotting the data and models. There are also other examples for how to manipulate plot using the returned object on the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") docs.
Plot a simple linear relationship between two variables:
```py
>>> import seaborn as sns; sns.set(color_codes=True)
>>> tips = sns.load_dataset("tips")
>>> g = sns.lmplot(x="total_bill", y="tip", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-1.png](img/86032eef9f0a340dfa9834cee96b10d4.jpg)
Condition on a third variable and plot the levels in different colors:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-2.png](img/ed002aaba578f2b1a6ae8d4677a52900.jpg)
Use different markers as well as colors so the plot will reproduce to black-and-white more easily:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips,
... markers=["o", "x"])
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-3.png](img/770464118d2458a098652af00c46525a.jpg)
Use a different color palette:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips,
... palette="Set1")
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-4.png](img/a314683a7f14a4e8a552aca52002c9b5.jpg)
Map `hue` levels to colors with a dictionary:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips,
... palette=dict(Yes="g", No="m"))
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-5.png](img/cc594c98f73700b14c9817d68ebc89c6.jpg)
Plot the levels of the third variable across different columns:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", col="smoker", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-6.png](img/3c50ee123e8192e2899983b1be19d34b.jpg)
Change the height and aspect ratio of the facets:
```py
>>> g = sns.lmplot(x="size", y="total_bill", hue="day", col="day",
... data=tips, height=6, aspect=.4, x_jitter=.1)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-7.png](img/47ce7b8d629a8d762bea59bc674e5490.jpg)
Wrap the levels of the column variable into multiple rows:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", col="day", hue="day",
... data=tips, col_wrap=2, height=3)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-8.png](img/798a1691371e0506570d9f1f72d95fe4.jpg)
Condition on two variables to make a full grid:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", row="sex", col="time",
... data=tips, height=3)
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-9.png](img/36048a5d4503fddb7cf3479a473188f2.jpg)
Use methods on the returned [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") instance to further tweak the plot:
```py
>>> g = sns.lmplot(x="total_bill", y="tip", row="sex", col="time",
... data=tips, height=3)
>>> g = (g.set_axis_labels("Total bill (US Dollars)", "Tip")
... .set(xlim=(0, 60), ylim=(0, 12),
... xticks=[10, 30, 50], yticks=[2, 6, 10])
... .fig.subplots_adjust(wspace=.02))
```
![http://seaborn.pydata.org/_images/seaborn-lmplot-10.png](img/11fc790735a7bdc59ac4a30d6af7e6d2.jpg)
\ No newline at end of file
# seaborn.regplot
```py
seaborn.regplot(x, y, data=None, x_estimator=None, x_bins=None, x_ci='ci', scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None, order=1, logistic=False, lowess=False, robust=False, logx=False, x_partial=None, y_partial=None, truncate=False, dropna=True, x_jitter=None, y_jitter=None, label=None, color=None, marker='o', scatter_kws=None, line_kws=None, ax=None)
```
Plot data and a linear regression model fit.
There are a number of mutually exclusive options for estimating the regression model. See the [tutorial](../tutorial/regression.html#regression-tutorial) for more information.
| Parameters: | **x, y: string, series, or vector array**
> Input variables. If strings, these should correspond with column names in `data`. When pandas objects are used, axes will be labeled with the series name.
**data** : DataFrame
> Tidy (“long-form”) dataframe where each column is a variable and each row is an observation.
**x_estimator** : callable that maps vector -&gt; scalar, optional
> Apply this function to each unique value of `x` and plot the resulting estimate. This is useful when `x` is a discrete variable. If `x_ci` is given, this estimate will be bootstrapped and a confidence interval will be drawn.
**x_bins** : int or vector, optional
> Bin the `x` variable into discrete bins and then estimate the central tendency and a confidence interval. This binning only influences how the scatterplot is drawn; the regression is still fit to the original data. This parameter is interpreted either as the number of evenly-sized (not necessary spaced) bins or the positions of the bin centers. When this parameter is used, it implies that the default of `x_estimator` is `numpy.mean`.
**x_ci** : “ci”, “sd”, int in [0, 100] or None, optional
> Size of the confidence interval used when plotting a central tendency for discrete values of `x`. If `"ci"`, defer to the value of the `ci` parameter. If `"sd"`, skip bootstrapping and show the standard deviation of the observations in each bin.
**scatter** : bool, optional
> If `True`, draw a scatterplot with the underlying observations (or the `x_estimator` values).
**fit_reg** : bool, optional
> If `True`, estimate and plot a regression model relating the `x` and `y` variables.
**ci** : int in [0, 100] or None, optional
> Size of the confidence interval for the regression estimate. This will be drawn using translucent bands around the regression line. The confidence interval is estimated using a bootstrap; for large datasets, it may be advisable to avoid that computation by setting this parameter to None.
**n_boot** : int, optional
> Number of bootstrap resamples used to estimate the `ci`. The default value attempts to balance time and stability; you may want to increase this value for “final” versions of plots.
**units** : variable name in `data`, optional
> If the `x` and `y` observations are nested within sampling units, those can be specified here. This will be taken into account when computing the confidence intervals by performing a multilevel bootstrap that resamples both units and observations (within unit). This does not otherwise influence how the regression is estimated or drawn.
**order** : int, optional
> If `order` is greater than 1, use `numpy.polyfit` to estimate a polynomial regression.
**logistic** : bool, optional
> If `True`, assume that `y` is a binary variable and use `statsmodels` to estimate a logistic regression model. Note that this is substantially more computationally intensive than linear regression, so you may wish to decrease the number of bootstrap resamples (`n_boot`) or set `ci` to None.
**lowess** : bool, optional
> If `True`, use `statsmodels` to estimate a nonparametric lowess model (locally weighted linear regression). Note that confidence intervals cannot currently be drawn for this kind of model.
**robust** : bool, optional
> If `True`, use `statsmodels` to estimate a robust regression. This will de-weight outliers. Note that this is substantially more computationally intensive than standard linear regression, so you may wish to decrease the number of bootstrap resamples (`n_boot`) or set `ci` to None.
**logx** : bool, optional
> If `True`, estimate a linear regression of the form y ~ log(x), but plot the scatterplot and regression model in the input space. Note that `x` must be positive for this to work.
**{x,y}_partial** : strings in `data` or matrices
> Confounding variables to regress out of the `x` or `y` variables before plotting.
**truncate** : bool, optional
> By default, the regression line is drawn to fill the x axis limits after the scatterplot is drawn. If `truncate` is `True`, it will instead by bounded by the data limits.
**{x,y}_jitter** : floats, optional
> Add uniform random noise of this size to either the `x` or `y` variables. The noise is added to a copy of the data after fitting the regression, and only influences the look of the scatterplot. This can be helpful when plotting variables that take discrete values.
**label** : string
> Label to apply to ether the scatterplot or regression line (if `scatter` is `False`) for use in a legend.
**color** : matplotlib color
> Color to apply to all plot elements; will be superseded by colors passed in `scatter_kws` or `line_kws`.
**marker** : matplotlib marker code
> Marker to use for the scatterplot glyphs.
**{scatter,line}_kws** : dictionaries
> Additional keyword arguments to pass to `plt.scatter` and `plt.plot`.
**ax** : matplotlib Axes, optional
> Axes object to draw the plot onto, otherwise uses the current Axes.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> The Axes object containing the plot.
|
| --- | --- |
See also
Combine [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") to plot multiple linear relationships in a dataset.Combine [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid") (when used with `kind="reg"`).Combine [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") (when used with `kind="reg"`).Plot the residuals of a linear regression model.
Notes
The [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`lmplot()`](seaborn.lmplot.html#seaborn.lmplot "seaborn.lmplot") functions are closely related, but the former is an axes-level function while the latter is a figure-level function that combines [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid").
It’s also easy to combine combine [`regplot()`](#seaborn.regplot "seaborn.regplot") and [`JointGrid`](seaborn.JointGrid.html#seaborn.JointGrid "seaborn.JointGrid") or [`PairGrid`](seaborn.PairGrid.html#seaborn.PairGrid "seaborn.PairGrid") through the [`jointplot()`](seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot") and [`pairplot()`](seaborn.pairplot.html#seaborn.pairplot "seaborn.pairplot") functions, although these do not directly accept all of [`regplot()`](#seaborn.regplot "seaborn.regplot")’s parameters.
Examples
Plot the relationship between two variables in a DataFrame:
```py
>>> import seaborn as sns; sns.set(color_codes=True)
>>> tips = sns.load_dataset("tips")
>>> ax = sns.regplot(x="total_bill", y="tip", data=tips)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-1.png](img/99b1873131479cf9f24377991b06cbdb.jpg)
Plot with two variables defined as numpy arrays; use a different color:
```py
>>> import numpy as np; np.random.seed(8)
>>> mean, cov = [4, 6], [(1.5, .7), (.7, 1)]
>>> x, y = np.random.multivariate_normal(mean, cov, 80).T
>>> ax = sns.regplot(x=x, y=y, color="g")
```
![http://seaborn.pydata.org/_images/seaborn-regplot-2.png](img/b6422e805157f85b21973dd3266dcb3f.jpg)
Plot with two variables defined as pandas Series; use a different marker:
```py
>>> import pandas as pd
>>> x, y = pd.Series(x, name="x_var"), pd.Series(y, name="y_var")
>>> ax = sns.regplot(x=x, y=y, marker="+")
```
![http://seaborn.pydata.org/_images/seaborn-regplot-3.png](img/2749fd423c61cc0419daeeec8d8aa467.jpg)
Use a 68% confidence interval, which corresponds with the standard error of the estimate:
```py
>>> ax = sns.regplot(x=x, y=y, ci=68)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-4.png](img/17710001d51c2a58f06feca00a0eaa56.jpg)
Plot with a discrete `x` variable and add some jitter:
```py
>>> ax = sns.regplot(x="size", y="total_bill", data=tips, x_jitter=.1)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-5.png](img/823e73942bde25e25637964d2bcd7acf.jpg)
Plot with a discrete `x` variable showing means and confidence intervals for unique values:
```py
>>> ax = sns.regplot(x="size", y="total_bill", data=tips,
... x_estimator=np.mean)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-6.png](img/b2bb1b6b97e36328f09b122b92dd52bf.jpg)
Plot with a continuous variable divided into discrete bins:
```py
>>> ax = sns.regplot(x=x, y=y, x_bins=4)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-7.png](img/90def53f341cf365a39051cbb1e17f61.jpg)
Fit a higher-order polynomial regression and truncate the model prediction:
```py
>>> ans = sns.load_dataset("anscombe")
>>> ax = sns.regplot(x="x", y="y", data=ans.loc[ans.dataset == "II"],
... scatter_kws={"s": 80},
... order=2, ci=None, truncate=True)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-8.png](img/1eb024fe4ee82e1fd71c47c29ebf1856.jpg)
Fit a robust regression and don’t plot a confidence interval:
```py
>>> ax = sns.regplot(x="x", y="y", data=ans.loc[ans.dataset == "III"],
... scatter_kws={"s": 80},
... robust=True, ci=None)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-9.png](img/83369998db2c4eb1e99c856c538f5cb2.jpg)
Fit a logistic regression; jitter the y variable and use fewer bootstrap iterations:
```py
>>> tips["big_tip"] = (tips.tip / tips.total_bill) > .175
>>> ax = sns.regplot(x="total_bill", y="big_tip", data=tips,
... logistic=True, n_boot=500, y_jitter=.03)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-10.png](img/b7d4fc0e5dd7fd0d56b558fc3316841a.jpg)
Fit the regression model using log(x) and truncate the model prediction:
```py
>>> ax = sns.regplot(x="size", y="total_bill", data=tips,
... x_estimator=np.mean, logx=True, truncate=True)
```
![http://seaborn.pydata.org/_images/seaborn-regplot-11.png](img/9c01b014a76320a976b7d86173685435.jpg)
\ No newline at end of file
# seaborn.residplot
```py
seaborn.residplot(x, y, data=None, lowess=False, x_partial=None, y_partial=None, order=1, robust=False, dropna=True, label=None, color=None, scatter_kws=None, line_kws=None, ax=None)
```
Plot the residuals of a linear regression.
This function will regress y on x (possibly as a robust or polynomial regression) and then draw a scatterplot of the residuals. You can optionally fit a lowess smoother to the residual plot, which can help in determining if there is structure to the residuals.
| Parameters: | **x** : vector or string
> Data or column name in &lt;cite&gt;data&lt;/cite&gt; for the predictor variable.
**y** : vector or string
> Data or column name in &lt;cite&gt;data&lt;/cite&gt; for the response variable.
**data** : DataFrame, optional
> DataFrame to use if &lt;cite&gt;x&lt;/cite&gt; and &lt;cite&gt;y&lt;/cite&gt; are column names.
**lowess** : boolean, optional
> Fit a lowess smoother to the residual scatterplot.
**{x, y}_partial** : matrix or string(s) , optional
> Matrix with same first dimension as &lt;cite&gt;x&lt;/cite&gt;, or column name(s) in &lt;cite&gt;data&lt;/cite&gt;. These variables are treated as confounding and are removed from the &lt;cite&gt;x&lt;/cite&gt; or &lt;cite&gt;y&lt;/cite&gt; variables before plotting.
**order** : int, optional
> Order of the polynomial to fit when calculating the residuals.
**robust** : boolean, optional
> Fit a robust linear regression when calculating the residuals.
**dropna** : boolean, optional
> If True, ignore observations with missing data when fitting and plotting.
**label** : string, optional
> Label that will be used in any plot legends.
**color** : matplotlib color, optional
> Color to use for all elements of the plot.
**{scatter, line}_kws** : dictionaries, optional
> Additional keyword arguments passed to scatter() and plot() for drawing the components of the plot.
**ax** : matplotlib axis, optional
> Plot into this axis, otherwise grab the current axis or make a new one if not existing.
|
| --- | --- |
| Returns: | ax: matplotlib axes
> Axes with the regression plot.
|
| --- | --- |
See also
Plot a simple linear regression model.marginal distrbutions.
\ No newline at end of file
此差异已折叠。
# seaborn.heatmap
```py
seaborn.heatmap(data, vmin=None, vmax=None, cmap=None, center=None, robust=False, annot=None, fmt='.2g', annot_kws=None, linewidths=0, linecolor='white', cbar=True, cbar_kws=None, cbar_ax=None, square=False, xticklabels='auto', yticklabels='auto', mask=None, ax=None, **kwargs)
```
Plot rectangular data as a color-encoded matrix.
This is an Axes-level function and will draw the heatmap into the currently-active Axes if none is provided to the `ax` argument. Part of this Axes space will be taken and used to plot a colormap, unless `cbar` is False or a separate Axes is provided to `cbar_ax`.
| Parameters: | **data** : rectangular dataset
> 2D dataset that can be coerced into an ndarray. If a Pandas DataFrame is provided, the index/column information will be used to label the columns and rows.
**vmin, vmax** : floats, optional
> Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments.
**cmap** : matplotlib colormap name or object, or list of colors, optional
> The mapping from data values to color space. If not provided, the default will depend on whether `center` is set.
**center** : float, optional
> The value at which to center the colormap when plotting divergant data. Using this parameter will change the default `cmap` if none is specified.
**robust** : bool, optional
> If True and `vmin` or `vmax` are absent, the colormap range is computed with robust quantiles instead of the extreme values.
**annot** : bool or rectangular dataset, optional
> If True, write the data value in each cell. If an array-like with the same shape as `data`, then use this to annotate the heatmap instead of the raw data.
**fmt** : string, optional
> String formatting code to use when adding annotations.
**annot_kws** : dict of key, value mappings, optional
> Keyword arguments for `ax.text` when `annot` is True.
**linewidths** : float, optional
> Width of the lines that will divide each cell.
**linecolor** : color, optional
> Color of the lines that will divide each cell.
**cbar** : boolean, optional
> Whether to draw a colorbar.
**cbar_kws** : dict of key, value mappings, optional
> Keyword arguments for &lt;cite&gt;fig.colorbar&lt;/cite&gt;.
**cbar_ax** : matplotlib Axes, optional
> Axes in which to draw the colorbar, otherwise take space from the main Axes.
**square** : boolean, optional
> If True, set the Axes aspect to “equal” so each cell will be square-shaped.
**xticklabels, yticklabels** : “auto”, bool, list-like, or int, optional
> If True, plot the column names of the dataframe. If False, don’t plot the column names. If list-like, plot these alternate labels as the xticklabels. If an integer, use the column names but plot only every n label. If “auto”, try to densely plot non-overlapping labels.
**mask** : boolean array or DataFrame, optional
> If passed, data will not be shown in cells where `mask` is True. Cells with missing values are automatically masked.
**ax** : matplotlib Axes, optional
> Axes in which to draw the plot, otherwise use the currently-active Axes.
**kwargs** : other keyword arguments
> All other keyword arguments are passed to `ax.pcolormesh`.
|
| --- | --- |
| Returns: | **ax** : matplotlib Axes
> Axes object with the heatmap.
|
| --- | --- |
See also
Plot a matrix using hierachical clustering to arrange the rows and columns.
Examples
Plot a heatmap for a numpy array:
```py
>>> import numpy as np; np.random.seed(0)
>>> import seaborn as sns; sns.set()
>>> uniform_data = np.random.rand(10, 12)
>>> ax = sns.heatmap(uniform_data)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-1.png](img/2dcc622657bb409719bb9c747e0456c4.jpg)
Change the limits of the colormap:
```py
>>> ax = sns.heatmap(uniform_data, vmin=0, vmax=1)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-2.png](img/6600f3e11ba368f49ec94d562dd39b4a.jpg)
Plot a heatmap for data centered on 0 with a diverging colormap:
```py
>>> normal_data = np.random.randn(10, 12)
>>> ax = sns.heatmap(normal_data, center=0)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-3.png](img/519a9ac2d3daa6dd6160e4f71bf0e342.jpg)
Plot a dataframe with meaningful row and column labels:
```py
>>> flights = sns.load_dataset("flights")
>>> flights = flights.pivot("month", "year", "passengers")
>>> ax = sns.heatmap(flights)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-4.png](img/dd89a846e99f54ceffc01f58b1545cc1.jpg)
Annotate each cell with the numeric value using integer formatting:
```py
>>> ax = sns.heatmap(flights, annot=True, fmt="d")
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-5.png](img/e28bcf9d1f72aedbb18ec128da502f35.jpg)
Add lines between each cell:
```py
>>> ax = sns.heatmap(flights, linewidths=.5)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-6.png](img/970cf8333ec7a6b8eec115254ad34265.jpg)
Use a different colormap:
```py
>>> ax = sns.heatmap(flights, cmap="YlGnBu")
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-7.png](img/e18cb02ed3ad1b91b540951f2912539b.jpg)
Center the colormap at a specific value:
```py
>>> ax = sns.heatmap(flights, center=flights.loc["January", 1955])
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-8.png](img/cf3d8b2d64f574209d01cfe330f3927b.jpg)
Plot every other column label and don’t plot row labels:
```py
>>> data = np.random.randn(50, 20)
>>> ax = sns.heatmap(data, xticklabels=2, yticklabels=False)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-9.png](img/a3dadd3fc0e3dcd7aba22164979fb558.jpg)
Don’t draw a colorbar:
```py
>>> ax = sns.heatmap(flights, cbar=False)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-10.png](img/be698c1c447b1398ee3d4501aef2415c.jpg)
Use different axes for the colorbar:
```py
>>> grid_kws = {"height_ratios": (.9, .05), "hspace": .3}
>>> f, (ax, cbar_ax) = plt.subplots(2, gridspec_kw=grid_kws)
>>> ax = sns.heatmap(flights, ax=ax,
... cbar_ax=cbar_ax,
... cbar_kws={"orientation": "horizontal"})
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-11.png](img/be6577fc41adf407960f66d71436521f.jpg)
Use a mask to plot only part of a matrix
```py
>>> corr = np.corrcoef(np.random.randn(10, 200))
>>> mask = np.zeros_like(corr)
>>> mask[np.triu_indices_from(mask)] = True
>>> with sns.axes_style("white"):
... ax = sns.heatmap(corr, mask=mask, vmax=.3, square=True)
```
![http://seaborn.pydata.org/_images/seaborn-heatmap-12.png](img/f683b3bba7ec2d231b917ed55aa858d1.jpg)
\ No newline at end of file
此差异已折叠。
此差异已折叠。
# seaborn.FacetGrid.map
```py
FacetGrid.map(func, *args, **kwargs)
```
Apply a plotting function to each facet’s subset of the data.
| Parameters: | **func** : callable
> A plotting function that takes data and keyword arguments. It must plot to the currently active matplotlib Axes and take a &lt;cite&gt;color&lt;/cite&gt; keyword argument. If faceting on the &lt;cite&gt;hue&lt;/cite&gt; dimension, it must also take a &lt;cite&gt;label&lt;/cite&gt; keyword argument.
**args** : strings
> Column names in self.data that identify variables with data to plot. The data for each variable is passed to &lt;cite&gt;func&lt;/cite&gt; in the order the variables are specified in the call.
**kwargs** : keyword arguments
> All keyword arguments are passed to the plotting function.
|
| --- | --- |
| Returns: | **self** : object
> Returns self.
|
| --- | --- |
\ No newline at end of file
# seaborn.FacetGrid.map_dataframe
```py
FacetGrid.map_dataframe(func, *args, **kwargs)
```
Like `.map` but passes args as strings and inserts data in kwargs.
This method is suitable for plotting with functions that accept a long-form DataFrame as a &lt;cite&gt;data&lt;/cite&gt; keyword argument and access the data in that DataFrame using string variable names.
| Parameters: | **func** : callable
> A plotting function that takes data and keyword arguments. Unlike the &lt;cite&gt;map&lt;/cite&gt; method, a function used here must “understand” Pandas objects. It also must plot to the currently active matplotlib Axes and take a &lt;cite&gt;color&lt;/cite&gt; keyword argument. If faceting on the &lt;cite&gt;hue&lt;/cite&gt; dimension, it must also take a &lt;cite&gt;label&lt;/cite&gt; keyword argument.
**args** : strings
> Column names in self.data that identify variables with data to plot. The data for each variable is passed to &lt;cite&gt;func&lt;/cite&gt; in the order the variables are specified in the call.
**kwargs** : keyword arguments
> All keyword arguments are passed to the plotting function.
|
| --- | --- |
| Returns: | **self** : object
> Returns self.
|
| --- | --- |
\ No newline at end of file
此差异已折叠。
# seaborn.PairGrid.map
```py
PairGrid.map(func, **kwargs)
```
Plot with the same function in every subplot.
| Parameters: | **func** : callable plotting function
> Must take x, y arrays as positional arguments and draw onto the “currently active” matplotlib Axes. Also needs to accept kwargs called `color` and `label`.
|
| --- | --- |
\ No newline at end of file
# seaborn.PairGrid.map_diag
```py
PairGrid.map_diag(func, **kwargs)
```
Plot with a univariate function on each diagonal subplot.
| Parameters: | **func** : callable plotting function
> Must take an x array as a positional argument and draw onto the “currently active” matplotlib Axes. Also needs to accept kwargs called `color` and `label`.
|
| --- | --- |
\ No newline at end of file
# seaborn.PairGrid.map_offdiag
```py
PairGrid.map_offdiag(func, **kwargs)
```
Plot with a bivariate function on the off-diagonal subplots.
| Parameters: | **func** : callable plotting function
> Must take x, y arrays as positional arguments and draw onto the “currently active” matplotlib Axes. Also needs to accept kwargs called `color` and `label`.
|
| --- | --- |
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
# seaborn.reset_defaults
```py
seaborn.reset_defaults()
```
Restore all RC params to default settings.
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册