Reputation: 5444
I have two boxplot diagrams in matlab which are the following one:
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. How can I do so?
Upvotes: 0
Views: 283
Reputation: 2462
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
. E.g. If male = 1
, female = 2
and bachelor = 1
, master = 2
it will "mix" the classes without throwing an error. In that case you would have to assign unique keys beforehand.
Upvotes: 1