未验证 提交 008959da 编写于 作者: G GKcmdr 提交者: GitHub

Update 20.md

上级 e5a535ed
...@@ -8,16 +8,16 @@ seaborn.barplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, ...@@ -8,16 +8,16 @@ seaborn.barplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
条形图用每个矩形的高度来表示数值变量的集中趋势的估计值,并提供误差条来显示估计值得不确定度。条形图的纵轴是从零开始的,这对于0值是有意义的情况是非常好的。 条形图用每个矩形的高度来表示数值变量的集中趋势的估计值,并提供误差条来显示估计值得不确定度。条形图的纵轴是从零开始的,这对于0值是有意义的情况是非常好的。
对于数据集中的0值没有实际意义的情况,点图可以让您专注于一个或多个分类变量之间的差异。 对于数据集中的0值没有实际意义的情况,点图可以让您专注于一个或多个分类变量之间的差异。
要注意的是,条形图只显示平均值(或者其他的估计值),但是在大部分情况下,展示数值在不同分类变量上的分布会更有用。如果要表示出数据的分布,用箱型图或者小提琴图会更恰当。 要注意的是,条形图只显示平均值(或者其他的估计值),但是在大部分情况下,展示数值在不同分类变量上的分布会更有用。如果要表示出数据的分布,用箱型图或者小提琴图会更恰当。
输入数据的格式可以不同,包括: 输入数据的格式可以不同,包括:
* 以列表,numpy array或者pandas中的Series object 表示的向量。这些向量可以直接传入 `x`, `y`, 以及 `hue` 参数。 * 以列表,numpy array或者pandas中的Series object 表示的向量。这些向量可以直接传入 `x`, `y`, 以及 `hue` 参数。
* 一个 “long-form” DataFrame, 即x值,y值和色相变量决定了数据是如何绘制的。 * “long-form” DataFrame, 即x值,y值和色相变量决定了数据是如何绘制的。
* 一个 “wide” DataFrame,每个列的数值都会被绘制出来. * “wide” DataFrame,每个列的数值都会被绘制出来.
* 一个数组或者一个列表的向量。 * 数组或者列表的向量。
大多数情况下,您可以使用numpy的对象或者python的对象,但是用pandas对象更好,因为相关的but pandas objects are preferable because the associated names will be used to annotate the axes. 另外,为了控制绘图元素 您也可以可以用分类类型来组合不同的变量。 大多数情况下,您可以使用numpy的对象或者python的对象,但是用pandas对象更好,因为相关的but pandas objects are preferable because the associated names will be used to annotate the axes. 另外,为了控制绘图元素 您也可以可以用分类类型来组合不同的变量。
...@@ -27,11 +27,11 @@ This function always treats one of the variables as categorical and draws data a ...@@ -27,11 +27,11 @@ This function always treats one of the variables as categorical and draws data a
| Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional | Parameters: | **x, y, hue** : names of variables in `data` or vector data, optional
> Inputs for plotting long-form data. See examples for interpretation. > 用于绘制long-form数据的变量名称.
**data** : DataFrame, array, or list of arrays, optional **data** : DataFrame, array, or list of arrays, optional
> 用于绘图的数据集。如果缺失X值和Y值, this is interpreted as wide-form. Otherwise it is expected to be long-form. > 用于绘图的数据集。如果缺失X值和Y值, 这个数据集会被解释成wide-form,否则this is interpreted as wide-form. Otherwise it is expected to be long-form.
**order, hue_order** : lists of strings, optional **order, hue_order** : lists of strings, optional
...@@ -138,7 +138,7 @@ Draw a set of horizontal bars: ...@@ -138,7 +138,7 @@ Draw a set of horizontal bars:
![http://seaborn.pydata.org/_images/seaborn-barplot-3.png](img/c3ea6265eaff0a4bfaec2966088cb66f.jpg) ![http://seaborn.pydata.org/_images/seaborn-barplot-3.png](img/c3ea6265eaff0a4bfaec2966088cb66f.jpg)
Control bar order by passing an explicit order: 通过传入一个显式的顺序来控制条柱的顺序:
```py ```py
>>> ax = sns.barplot(x="time", y="tip", data=tips, >>> ax = sns.barplot(x="time", y="tip", data=tips,
...@@ -148,7 +148,7 @@ Control bar order by passing an explicit order: ...@@ -148,7 +148,7 @@ Control bar order by passing an explicit order:
![http://seaborn.pydata.org/_images/seaborn-barplot-4.png](img/9233554272a5e436f6ab85c97a65010c.jpg) ![http://seaborn.pydata.org/_images/seaborn-barplot-4.png](img/9233554272a5e436f6ab85c97a65010c.jpg)
Use median as the estimate of central tendency: 用中值来评估数据的集中趋势:
```py ```py
>>> from numpy import median >>> from numpy import median
...@@ -167,7 +167,7 @@ Show the standard error of the mean with the error bars: ...@@ -167,7 +167,7 @@ Show the standard error of the mean with the error bars:
![http://seaborn.pydata.org/_images/seaborn-barplot-6.png](img/d1310bd7e87a8549d1f0b3a1479fc06d.jpg) ![http://seaborn.pydata.org/_images/seaborn-barplot-6.png](img/d1310bd7e87a8549d1f0b3a1479fc06d.jpg)
Show standard deviation of observations instead of a confidence interval: 展示数据的标准差:
```py ```py
>>> ax = sns.barplot(x="day", y="tip", data=tips, ci="sd") >>> ax = sns.barplot(x="day", y="tip", data=tips, ci="sd")
...@@ -185,7 +185,7 @@ Add “caps” to the error bars: ...@@ -185,7 +185,7 @@ Add “caps” to the error bars:
![http://seaborn.pydata.org/_images/seaborn-barplot-8.png](img/5a69e1058d9b8b4b5be6dc15d1bad130.jpg) ![http://seaborn.pydata.org/_images/seaborn-barplot-8.png](img/5a69e1058d9b8b4b5be6dc15d1bad130.jpg)
Use a different color palette for the bars: 使用一个不同的颜色条:
```py ```py
>>> ax = sns.barplot("size", y="total_bill", data=tips, >>> ax = sns.barplot("size", y="total_bill", data=tips,
...@@ -216,7 +216,7 @@ Use `hue` without changing bar position or width: ...@@ -216,7 +216,7 @@ Use `hue` without changing bar position or width:
![http://seaborn.pydata.org/_images/seaborn-barplot-11.png](img/4922c693b75b7656b2f16f8fd2dd6509.jpg) ![http://seaborn.pydata.org/_images/seaborn-barplot-11.png](img/4922c693b75b7656b2f16f8fd2dd6509.jpg)
Use `plt.bar` keyword arguments to further change the aesthetic: `plt.bar` keyword arguments to further change the aesthetic:
```py ```py
>>> ax = sns.barplot("day", "total_bill", data=tips, >>> ax = sns.barplot("day", "total_bill", data=tips,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册