我有一系列的箱线图,我想以xtick为中心(每个xtick有2个)。考虑以下因素:
# fake up some more data
spread= rand(50) * 100
center = ones(25) * 40
flier_high = rand(10) * 100 + 100
flier_low = rand(10) * -100
d2 = 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
figure()
boxplot(data)
产生
但是我想有6个箱线图,2个围绕1,2个围绕2,等等。。。如果我再加上三个,它就把它们加到4,5,6。。。任何帮助都将不胜感激
编辑明确我所说的“居中”。我想要一个方框图就在标签为“1”的xtick的左边,另一个就在右边。它们很可能在y范围内重叠,所以我不想让它们互相重叠。在
要控制boxplots的x位置,请使用
positions
kwarg。在例如:
如果你想让小组并排,你需要自己计算位置。一种方法可能是这样的:
^{pr2}$作为使用它的一个简单例子:
……只是为了展示一个过于奇特的例子:
相关问题 更多 >
编程相关推荐