Defines the length of the whiskers as a function of the inner quartile range. They extend to the most extreme data point within ( whis*(75%-25%) ) data range.
The box extends from the lower to upper quartile values of the data, with a line at the median.
也就是说,四分之一的输入数据值在方框下方,四分之一在方框上方。
问题B:
whis : float, sequence, or string (default = 1.5)
As a float, determines the reach of the whiskers to the beyond the
first and third quartiles. In other words, where IQR is the
interquartile range (Q3-Q1), the upper whisker will extend to last
datum less than Q3 + whis*IQR). Similarly, the lower whisker will
extend to the first datum greater than Q1 - whis*IQR. Beyond the
whiskers, data are considered outliers and are plotted as individual
points.
Matplotlib(和Pandas)还提供了许多选项来更改胡须的默认定义:
Set this to an unreasonably high value to force the whiskers to show
the min and max values. Alternatively, set this to an ascending
sequence of percentile (e.g., [5, 95]) to set the whiskers at specific
percentiles of the data. Finally, whis can be the string 'range' to
force the whiskers to the min and max of the data.
一幅画胜过千言万语。请注意,离群值(图中的
+
标记)只是指下方宽[(Q1-1.5 IQR), (Q3+1.5 IQR)]
边距的外部点。然而,该图仅是正态分布数据集的示例。重要的是要了解matplotlib不会首先估计正态分布,并根据上面所示的估计分布参数计算四分位数。
相反,中位数和四分位数是直接从数据中计算出来的。因此,根据数据的分布和样本的大小,箱线图可能看起来有所不同,例如,非对称且有或多或少的异常值。
方框表示第一和第三个四分位数,红线表示中间值(第二个四分位数)。documentation给出了1.5 IQR下的默认晶须:
以及
如果您对不同的方框图表示法感到困惑,请尝试读取the description in wikipedia。
这是一个图解,说明了来自stats.stackexchange answer的盒子的组件。注意,如果不在Pandas中提供
whis
关键字,k=1.5。Pandas中的boxplot函数是
matplotlib.pyplot.boxplot
的包装器。matplotlib docs详细解释了盒子的组件:问题A:
也就是说,四分之一的输入数据值在方框下方,四分之一在方框上方。
问题B:
Matplotlib(和Pandas)还提供了许多选项来更改胡须的默认定义:
相关问题 更多 >
编程相关推荐