Grouped boxplot with different lengths
25 views (last 30 days)
Show older comments
Commented: Poulomi Ganguli on 29 Jul 2019
I want to plot grouped boxplot in a single figure. My cell array contains foll mxn matrices.:
Each of these Gs' are different groups for which I need to plot 6 boxplot for these 3 sub-groups. Any help?
Adam Danz on 29 Jul 2019
Edited: Adam Danz on 29 Jul 2019
You can vertically contatenate all of you data into a single column and use a [n x 2] grouping variable 'group' where group(:,1) identifies the G1, G2, G3 groups and group(:,2) identifies the column1 and column2 groups. Note that these groupings are also indicated in the x tick labels.
G1 = rand(108,2)-.5+[0,1];
G2 = rand(293,2)-.5+[2,4];
G3 = rand(30,2)-.5+[3,6];
group = [repelem([1;2;3],[numel(G1),numel(G2),numel(G3)]), ...
More Answers (0)
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!