[英]Why is distplot changing the range of values plotted?
I have an array of values for which I am trying to fit a probability density function.我有一个值数组,我试图拟合概率密度 function。 I plotted the histogram using distplot as shown below:
我使用 distplot 绘制了直方图,如下所示:
x = [ 17.56,
162.52,
172.58,
160.82,
182.14,
165.86,
242.06,
135.76,
122.86,
230.22,
208.66,
271.36,
122.68,
188.42,
171.82,
102.30,
196.40,
107.38,
192.35,
179.66,
173.30,
254.66,
176.12,
75.365,
135.78,
103.66,
183.50,
166.08,
207.66,
146.22,
151.19,
172.20,
103.41,
133.93,
186.48,]
sns.distplot(x)
and the plot looks like this: plot 看起来像这样:
My minimum value in the array is 17 and maximum value is around 250 so I don't understand the range on the x-axis in the figure as I have not added any arguments either.我在数组中的最小值是 17,最大值是 250 左右,所以我不明白图中 x 轴的范围,因为我也没有添加任何 arguments。 Does
sns.displot
standardize the data before plotting? sns.displot
在绘图之前是否对数据进行标准化?
A kde curve fits many gaussian normal curves over the data points. kde 曲线在数据点上拟合许多高斯正态曲线。 Such a normal curve has an infinite tail, which here is cut off when it gets close enough to zero height.
这样一条法线曲线有一条无限的尾巴,当它足够接近零高度时,它就会被切断。
Note that sns.distplot
has been deprecated since seaborn 0.11, and replaced by (in this case) sns.histplot(..., kde=True)
.请注意,自 seaborn 0.11 起,
sns.distplot
已被弃用,并由(在这种情况下) sns.histplot(..., kde=True)
取代。 The new kdeplot has a parameter cut=
which defaults to zero, cutting the curve at the data limits ( cut
is one of the kde_kws
in histplot
: sns.histplot(x, kde=True, kde_kws={'cut': 0}).
).新的 kdeplot有一个参数
cut=
默认为零,在数据限制处切割曲线( cut
是kde_kws
中的histplot
: sns.histplot(x, kde=True, kde_kws={'cut': 0}).
).
import seaborn as sns
x = [17.56, 162.52, 172.58, 160.82, 182.14, 165.86, 242.06, 135.76, 122.86, 230.22, 208.66, 271.36, 122.68, 188.42,
171.82, 102.30, 196.40, 107.38, 192.35, 179.66, 173.30, 254.66, 176.12, 75.365, 135.78, 103.66, 183.50, 166.08,
207.66, 146.22, 151.19, 172.20, 103.41, 133.93, 186.48]
sns.histplot(x, kde=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.