seaborn
Hey, folks! In this article, we will be focusing on Seaborn Distplot in detail.
嘿伙计! 在本文中,我们将重点关注Seaborn Distplot 。
什么是Seaborn Distplot? (What is a Seaborn Distplot?)
A Distplot or distribution plot, depicts the variation in the data distribution. Seaborn Distplot represents the overall distribution of continuous data variables.
一个Distplot或分布图,描绘了在数据分布的变化。 Seaborn Distplot代表连续数据变量的整体分布。
The Seaborn module along with the Matplotlib module is used to depict the distplot with different variations in it. The Distplot depicts the data by a histogram and a line in combination to it.
Seaborn模块与Matplotlib模块一起用于描述具有不同变体的distplot。 Distplot通过直方图和与其组合的线来描述数据。
创建海底Distplot (Creating a Seaborn Distplot)
Python Seaborn module contains various functions to plot the data and depict the data variations. The seaborn.distplot() function
is used to plot the distplot. The distplot represents the univariate distribution of data i.e. data distribution of a variable against the density distribution.
Python Seaborn模块包含各种功能,可以绘制数据并描述数据变化。 seaborn.distplot() function
用于绘制distplot。 分布图表示数据的单变量分布,即变量相对于密度分布的数据分布。
Syntax:
句法:
seaborn.distplot()
The seaborn.distplot() function accepts the data variable as an argument and returns the plot with the density distribution.
seaborn.distplot()函数接受数据变量作为参数,并返回具有密度分布的图。
Example 1:
范例1:
import numpy as np
import seaborn as sn
import matplotlib.pyplot as plt
data = np.random.randn(200)
res = sn.distplot(data)
plt.show()
We have used the numpy.random.randn() function
to generate random data values. Further, the pyplot.show() function
is used show the plot.
我们使用了numpy.random.randn() function
来生成随机数据值。 此外,使用pyplot.show() function
显示图。
Output:
输出: