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. 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.
# fake up some more data
spread = np.random.rand(50) * 100
center = np.ones(25) * 40
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
d2 = np.concatenate((spread, center, flier_high, flier_low), 0)
data.shape = (-1, 1)
d2.shape = (-1, 1)
# data = concatenate( (data, d2), 1 )
# Making a 2-D array only works if all the columns are the
# same length. If they are not, then use a list instead.
# This is actually more efficient because boxplot converts
# a 2-D array into a list of vectors internally anyway.
data = [data, d2, d2[::2, 0]]
# multiple box plots on one figure
在创建方框图时,可以添加参数
whis
matplotlib.axes.Axes.boxplot
一些直接来自boxplot example的假数据
在Line2D实例的pyplot.boxplot returns a dictionary中,
^{pr2}$caps
是您想要更改的。这个解决方案将使它们长0.5个x轴单位,设置它们的颜色和线宽。在Artist Tutorial
相关问题 更多 >
编程相关推荐