[英]Have multiple box plot in matlab
I have two boxplot diagrams in matlab which are the following one: 我在matlab中有两个箱形图,如下图:
boxplot(input1(:,2), input1(:,1)) % time accompilishing a task among genders (male/female)
boxplot(input2(:,2), input2(:,1)) % time accompilishing a task among degree (bachelor/master)
What I want is to compine both diagrams in the same plot. 我想要的是在同一图中组合两个图。 So for the four cases in x-axis to have the time in y-axis.
因此,对于x轴上的四种情况,时间在y轴上。 How can I do so?
我该怎么办?
You can solve this by simply concatenating the tables vertically: 您可以通过简单地垂直连接表来解决此问题:
input = [input1;input2];
boxplot(input(:,2), input(:,1))
This is assuming that the groups in input1
have different keys than the ones in input2
. 这是假设
input1
中的组具有与input2
中的组不同的键。 Eg If male = 1
, female = 2
and bachelor = 1
, master = 2
it will "mix" the classes without throwing an error. 例如,如果
male = 1
, female = 2
, bachelor = 1
, master = 2
,它将“混合”类而不会引发错误。 In that case you would have to assign unique keys beforehand. 在这种情况下,您必须事先分配唯一的密钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.