title: Grouping boxplot matlab
body: <p>I have x=rand(1000,6); y=rand(1000,6); D(:,1:2:12)=x; D(:,2:2:12)=y;</p>
  
  <p>I would like to plot a grouped <code>boxplot</code> where x(:,i) and y(:,i) are grouped boxplots (or factor pairs). But can't seem to work out how to specify the groupings.</p>
  
  <p>Thus:</p>
  
  <pre><code>figure('color',[1,1,1]);
  boxplot(D,'factorgap',10,'color','rk')
  axis([0 25 -1 5])
  
  set(gca,'xtick',1.8:4.3:50)
  set(gca,'ytick',0:10)
  set(gca,'xticklabel',{'Direct care','Housekeeping','Mealtimes','Medication','Miscellaneous','Personal care'})
  
  ylabel('Normalised Y');
   legend(findobj(gca,'Tag','Box'),'HBN04-01 multibed','YAB single ')
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/98kbm.png" alt="enter image description here"></p>
  
  <p>But it looks a bit untidy, how do I get the gaps between pairs of boxplots larger?</p>