I would like to draw a bar chart with "unequal samples". Here is an example code
A = [16 20 15 17 22 19 17]';
B = [22 15 16 16 16 18]';
C = [23 9 15 18 13 27 17 14 16 15 21 19 17]';
group = [ ones(size(A));
2 * ones(size(B));
3 * ones(size(C))];
figure
boxplot([A; B; C],group)
set(gca,'XTickLabel',{'A','B','C'})
However, I would like to have a distance between group1,2 with group 3. As same as what you see in the figure below:(this figure is just a copy paste from another source but the distance between box plot of each group is visible)
I tried to use 'factorgap' in such command
figure
boxplot([A; B; C ],group,'factorgap',[50,1])
However, because the number of samples in each group is different it did not work.
Any suggestion?
The first solution I propose you is in fact a small workaround that consists in inserting another, invisible group between the second and the third one:
Here is the output:
Now, let's build up something serious:
Here is the output: