未验证 提交 7643475a 编写于 作者: A alohahahaha 提交者: GitHub

Update 5.md

上级 b27eab21
......@@ -117,10 +117,11 @@ sns.rugplot(x);
![http://seaborn.pydata.org/_images/distributions_22_0.png](img/63e498131614f726dd72a90161b58971.jpg)
### Fitting parametric distributions
### 拟合参数分布
You can also use [`distplot()`](../generated/seaborn.distplot.html#seaborn.distplot "seaborn.distplot") to fit a parametric distribution to a dataset and visually evaluate how closely it corresponds to the observed data:
您还可以使用 [`distplot()`](../generated/seaborn.distplot.html#seaborn.distplot "seaborn.distplot")
将参数分布拟合到数据集上,并直观地评估其与观测数据的对应程度:
```py
x = np.random.gamma(6, size=200)
sns.distplot(x, kde=False, fit=stats.gamma);
......@@ -129,9 +130,9 @@ sns.distplot(x, kde=False, fit=stats.gamma);
![http://seaborn.pydata.org/_images/distributions_24_0.png](img/cf48dc45f5484db58f3d310e434b11a2.jpg)
## Plotting bivariate distributions
## 绘制二元分布
It can also be useful to visualize a bivariate distribution of two variables. The easiest way to do this in seaborn is to just use the [`jointplot()`](../generated/seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot") function, which creates a multi-panel figure that shows both the bivariate (or joint) relationship between two variables along with the univariate (or marginal) distribution of each on separate axes.
它对于可视化两个变量的二元分布也很有用。在seaborn中,最简单的方法就是使用[`jointplot()`](../generated/seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot")函数,它创建了一个多面板图形,显示了两个变量之间的二元(或联合)关系,以及每个变量在单独轴上的一元(或边际)分布。
```py
mean, cov = [0, 1], [(1, .5), (.5, 1)]
......@@ -140,9 +141,9 @@ df = pd.DataFrame(data, columns=["x", "y"])
```
### Scatterplots
### 散点图
The most familiar way to visualize a bivariate distribution is a scatterplot, where each observation is shown with point at the _x_ and _y_ values. This is analgous to a rug plot on two dimensions. You can draw a scatterplot with the matplotlib `plt.scatter` function, and it is also the default kind of plot shown by the [`jointplot()`](../generated/seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot") function:
可视化二元分布最常见的方法是散点图,其中每个观察点都以_x_和_y_值表示。 这类似于二维rug plot。 您可以使用matplotlib的`plt.scatter` 函数绘制散点图, 它也是 [`jointplot()`](../generated/seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot")函数显示的默认类型的图:
```py
sns.jointplot(x="x", y="y", data=df);
......@@ -151,7 +152,7 @@ sns.jointplot(x="x", y="y", data=df);
![http://seaborn.pydata.org/_images/distributions_28_0.png](img/66ba868aeef60b82d90c872e188217ed.jpg)
### Hexbin plots
### 六角形箱(Hexbin)图
The bivariate analogue of a histogram is known as a “hexbin” plot, because it shows the counts of observations that fall within hexagonal bins. This plot works best with relatively large datasets. It’s available through the matplotlib `plt.hexbin` function and as a style in [`jointplot()`](../generated/seaborn.jointplot.html#seaborn.jointplot "seaborn.jointplot"). It looks best with a white background:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册