Use the position
property:
A = [1 2 3 4 5];
B = [7 8 9 10 11];
group = [repmat({'First'}, 5, 1); repmat({'Second'}, 5, 1)];
boxplot([A';B'], group, 'orientation', 'horizontal','positions',[1 1])
As you can see, the y-labels are screwed up and manual labeling is required.
... which is quite easy to solve by just substituting {'Second'}
with {' '}
. You could use annotations instead for manual labeling.
group = [repmat({'boxplots'}, 5, 1); repmat({' '}, 5, 1)];
boxplot([A';B'], group, 'orientation', 'horizontal','positions',[1 1])
annotation('textbox', [0.35,0.8,0.07,0.06],...
'String', 'First','LineStyle','none');
annotation('textbox', [0.7,0.8,0.11,0.06],...
'String', 'Second','LineStyle','none');