未验证 提交 f68a8110 编写于 作者: 飞龙 提交者: GitHub

Merge pull request #33 from Stuming/master

Update 10.md
# seaborn.relplot
> 译者:[Stuming](https://github.com/Stuming)
```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:
绘制相关关系图像到FacetGrid的图像级别接口。
* [`scatterplot()`](seaborn.scatterplot.html#seaborn.scatterplot "seaborn.scatterplot") (with `kind="scatter"`; the default)
* [`lineplot()`](seaborn.lineplot.html#seaborn.lineplot "seaborn.lineplot") (with `kind="line"`)
此函数提供对一些不同轴级别函数的访问,这些函数通过子集的语义映射显示两个变量之间的关系。`kind`参数选择要使用的基础轴级函数:
* [`scatterplot()`](seaborn.scatterplot.html#seaborn.scatterplot "seaborn.scatterplot") (通过`kind="scatter"`访问;默认为此)
* [`lineplot()`](seaborn.lineplot.html#seaborn.lineplot "seaborn.lineplot") (通过`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.
对于数据不同子集的`x``y`的绘制关系可以通过`hue`, `size`以及`style`参数控制。这些参数控制使用哪些视觉语义来区分不同的子集。使用所有三个语义类型可以独立展示三个维度,但是这种方式得到的绘制结果难以被理解而且低效。使用多种语义(例如对相同变量同时使用`hue``style`)可以使图像更加易懂。
See the [tutorial](../tutorial/relational.html#relational-tutorial) for more information.
参考[tutorial](../tutorial/relational.html#relational-tutorial)获得更多信息。
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.
绘制后,会返回带有图像的[`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"),随后可以直接进行图像细节调节或者加入其他图层。
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.
值得注意的是,与直接使用隐含函数的方式不同,数据必须以长格式的DataFrame传入,同时变量通过`x`, `y`及其他参数指定。
参数:`x, y`names of variables in `data`
参数:`x, y``data`中的变量名
> Input data variables; must be numeric.
> 输入数据的变量;数据必须为数值型。
`hue`:name in `data`, optional
`hue`: `data`中的名称,可选
> 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
`size``data`中的名称,可选
> 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
`style``data`中的名称,可选
> 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.
> 长格式的DataFrame,每列是一个变量,每行是一个观察值。
`row, col`names of variables in `data`, optional
`row, col``data`中的变量名,可选
> Categorical variables that will determine the faceting of the grid.
> 确定网格的分面的类别变量。
`col_wrap`:int, optional
`col_wrap`:int, 可选
> “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a `row` facet.
> 以此宽度“包裹”列变量,以便列分面跨越多行。与`row`分面不兼容。
`row_order, col_order`lists of strings, optional
`row_order, col_order`字符串列表,可选
> 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
`palette`色盘名,列表,或者字典,可选
> 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`变量的不同级别的颜色。应当是[`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette")可以解释的东西,或者将色调级别映射到matplotlib颜色的字典。
`hue_order`list, optional
`hue_order`列表,可选
> 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`变量层级出现的顺序,否则会根据数据确定。当`hue`变量为数值型时与此无关。
`hue_norm`tuple or Normalize object, optional
`hue_norm`元组或者Normalize对象,可选
> Normalization in data units for colormap applied to the `hue` variable when it is numeric. Not relevant if it is categorical.
> 当`hue`变量为数值型时,用于数据单元的colormap的标准化。如果`hue`为类别变量则与此无关。
`sizes`list, dict, or tuple, optional
`sizes`列表、典或者元组,可选
> 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.
> 当使用`sizes`时,用于确定如何选择尺寸。此变量可以一直是尺寸值的列表或者`size`变量的字典映射。当`size`为数值型时,此变量也可以是指定最小和最大尺寸的元组,这样可以将其他值标准化到这个范围。
`size_order`list, optional
`size_order`列表,可选
> 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`变量层次的表现顺序,不指定则会通过数据确定。当`size`变量为数值型时与此无关。
`size_norm`tuple or Normalize object, optional
`size_norm`元组或者Normalize对象,可选
> Normalization in data units for scaling plot objects when the `size` variable is numeric.
> 当`size`变量为数值型时,用于数据单元的scaling plot对象的标准化。
`legend`:“brief”, “full”, or False, optional
`legend`:“brief”, “full”, 或者False, 可选
> 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.
> 用于决定如何绘制坐标轴。如果参数值为“brief”, 数值型的`hue`以及`size`变量将会被用等间隔采样值表示。如果参数值为“full”, 每组都会在坐标轴中被记录。如果参数值为“false”, 不会添加坐标轴数据,也不会绘制坐标轴。
`kind`:string, optional
`kind`:string, 可选
> Kind of plot to draw, corresponding to a seaborn relational plot. Options are {`scatter` and `line`}.
> 绘制图的类型,与seaborn相关的图一致。可选项为(`scatter`及`line`).
`height`scalar, optional
`height`标量, 可选
> Height (in inches) of each facet. See also: `aspect`.
> 每个facet的高度(英寸)。参见`aspect`。
`aspect`scalar, optional
`aspect`标量, 可选
> Aspect ratio of each facet, so that `aspect * height` gives the width of each facet in inches.
> 每个facet的长宽比,因此“长宽比*高度”可以得出每个facet的宽度(英寸)。
`facet_kws`:dict, optional
`facet_kws`:dict, 可选
> Dictionary of other keyword arguments to pass to [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid").
> 以字典形式传给[`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid")的其他关键字参数.
`kwargs`key, value pairings
`kwargs`键值对
> Other keyword arguments are passed through to the underlying plotting function.
> 传给后续绘制函数的其他关键字参数。
返回值:`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.
> 返回包含图像的[`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid")对象,图像可以进一步调整。
Examples
示例
Draw a single facet to use the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") legend placement:
使用[`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid")的坐标轴布局绘制简单的facet。
```py
>>> import seaborn as sns
......@@ -122,7 +123,7 @@ Draw a single facet to use the [`FacetGrid`](seaborn.FacetGrid.html#seaborn.Face
![http://seaborn.pydata.org/_images/seaborn-relplot-1.png](img/1c7fa44b0679b71a3e8e8a4e26d75963.jpg)
Facet on the columns with another variable:
利用其他变量绘制facet:
```py
>>> g = sns.relplot(x="total_bill", y="tip",
......@@ -132,7 +133,7 @@ Facet on the columns with another variable:
![http://seaborn.pydata.org/_images/seaborn-relplot-2.png](img/f0eb2f840a13f8dbd2b829e6bb51c4af.jpg)
Facet on the columns and rows:
绘制两行两列的facet:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="day",
......@@ -142,7 +143,7 @@ Facet on the columns and rows:
![http://seaborn.pydata.org/_images/seaborn-relplot-3.png](img/e6f2f0c866185be9801d43c59f348826.jpg)
“Wrap” many column facets into multiple rows:
将多行facets转换为多列:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="time",
......@@ -152,7 +153,7 @@ Facet on the columns and rows:
![http://seaborn.pydata.org/_images/seaborn-relplot-4.png](img/a89db144a2f030e70603b92ba8728326.jpg)
Use multiple semantic variables on each facet with specified attributes:
利用指定的属性值对每个facet使用多种语义变量:
```py
>>> g = sns.relplot(x="total_bill", y="tip", hue="time", size="size",
......@@ -163,7 +164,7 @@ Use multiple semantic variables on each facet with specified attributes:
![http://seaborn.pydata.org/_images/seaborn-relplot-5.png](img/79d93fb6cd8974ec779ead1b35e2aad1.jpg)
Use a different kind of plot:
使用不同类型的图:
```py
>>> fmri = sns.load_dataset("fmri")
......@@ -175,7 +176,7 @@ Use a different kind of plot:
![http://seaborn.pydata.org/_images/seaborn-relplot-6.png](img/f14f4331afb42bd5512f2c24a5140604.jpg)
Change the size of each facet:
改变每个facet的大小:
```py
>>> g = sns.relplot(x="timepoint", y="signal",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册