title: How can I adjust 3-D bar grouping and y-axis labeling in MATLAB?
body: <p>I have a 3D plot like this:</p>
  
  <p><img src="https://i.stack.imgur.com/bITPA.png" alt="alt text"></p>
  
  <p>On the y-axis of the plot, each group of three bars refers to the same parameters: x1, x2, x3. I would like to have a spacing on the y-axis for each group of three bars, so that it becomes more clear that those bars are referring to the same parameters. At the same time, I would like to put a label on the y-axis for each group of three bars. For example, the following label layout for the y-axis would be desired:</p>
  
  <pre><code>x1 x2 x3   x1 x2 x3   x1 x2 x3
    grid1     grid2      grid3
  </code></pre>
  
  <p>Any suggestions are more than welcome! The code that I used to plot the bars is given below:</p>
  
  <pre><code>Z = rand(9,5);
  h = bar3(Z);
  [r c] = size(Z);
  
  zdata = [];
  for i = 1:c
      zdata = [];
      for j = 1:r
          zdata = [zdata; ones(6,4)*Z(j,i)];
      end
  set(h(i),'Cdata',zdata)
  end
  colormap
  colorbar
  set(gca,'YTickLabel',['x1';'x2';'x3';'x1';'x2';'x3';'x1';'x2';'x3']);
  view([-64 44]);
  </code></pre>