How do I make a boxplot with a few groups?

a = rand(10,2);
b = rand(10,2);
boxplot([a,b]);
I want to have one figure with to groups - a and b, where the two vectors of 'a' will be close and the two vectors of 'b' will be close, but the two groups will be far from one another.
Thanks,
Ziv

1 件のコメント

Adam Danz
Adam Danz 2020 年 9 月 24 日
In addition to Abdolkarim Mohammadi-Balani's perfectly fine answer,

サインインしてコメントする。

回答 (1 件)

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 9 月 1 日
編集済み: Abdolkarim Mohammadi 2020 年 9 月 1 日

0 投票

You can add some columns of NaN.
a = rand(10,2);
b = rand(10,2);
c = nan(10,2);
boxplot([a,c,b]);
xticks ([1,2,5,6]);
xticklabels (["a1","a2","b1","b2"]);

製品

リリース

R2018b

タグ

質問済み:

2020 年 9 月 1 日

コメント済み:

2020 年 9 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by