title: MATLAB: Plotting/Saving X-Y views of mesh function in subplots
body: <p>As the title says, I'm trying to save the 2-variable slices of a mesh function (as a .jpg, for example) as a subplot. I want to do this using a .m file because I have many plots to generate. I have figured out how to plot the views on their own figures, but I cannot get them to plot properly as subplots within a figure. To illustrate what I mean:</p>
  
  <p>Here are the outputs on individual plots:<br><br>
  3D mesh: <a href="http://i39.tinypic.com/xnra76.jpg" rel="nofollow">3D MATLAB mesh plot</a><br>
  XY view: <a href="http://i39.tinypic.com/25ktrhy.jpg" rel="nofollow">XY MATLAB mesh view</a><br>
  YZ view: <a href="http://i39.tinypic.com/hvuuio.jpg" rel="nofollow">YZ MATLAB mesh view</a><br>
  XZ view: <a href="http://i41.tinypic.com/14ttv9c.jpg" rel="nofollow">XZ MATLAB mesh view</a><br></p>
  
  <p>And here is my plotting code (not working):</p>
  
  <pre><code>%Ambiguity Surface
  fid = figure(fnum);
      axes1 = axes('Parent',fid);
      view(axes1,[-62.5 28]);
      grid(axes1,'on');
      hold(axes1,'all');
      msh = mesh(taux,fdy,z,'Parent',axes1);
      xlabel ('Delay - seconds');
      ylabel ('Doppler - Hz');
      zlabel ('Ambiguity function (Normalized Magnitude-Squared)');
      fname = strcat(name,' (Ambiguity Function z(\tau;F_d))');
      title(fname);
      cb = colorbar('peer',axes1);
      set(get(cb,'ylabel'),'String','Magnitude-Squared (dB)');
      hold off;
      printFig(fid,fnum,sname)
      fnum = fnum + 1;
  
  %Ambiguity Slices
  fid = figure(fnum);
      hold all;
      subplot(2,1,1);
          axes1 = axes();
          grid(axes1,'on');
          view(axes1,[90 0]);
          msh = mesh(taux,fdy,z);
          xlabel ('Delay - seconds','Visible','off');
          ylabel ('Doppler - Hz');
          zlabel ('Ambiguity function (Normalized Magnitude-Squared)','Visible','off');
          fname = strcat(name,' (Ambiguity Function Slice z(\tau;F_d) @ \tau = 128)');
          title(fname)
      subplot(2,1,2);
          axes2 = axes();
          grid(axes2,'on');
          view(axes2,[0 0]);
          msh = mesh(taux,fdy,z);
          xlabel ('Delay - seconds','Visible','off');
          ylabel ('Doppler - Hz','Visible','off');
          zlabel ('Ambiguity function (Normalized Magnitude-Squared)','Visible','off');
          cb = colorbar('peer',axes2);
          set(get(cb,'ylabel'),'String','Magnitude-Squared');
          fname = strcat(name,' (Ambiguity Function Slice z(\tau;F_d) @ F_d = 0)');
          title(fname)
      hold off;
      printFig(fid,fnum,slname)
      fnum = fnum+1;
  </code></pre>
  
  <p>printFig() just sets up directory info and does <code>print</code> command.</p>
  
  <p>My code sets up the two subplots and then overlays a full 3-d view of the mesh plot, which is not what I want. I'd like to see two of the views (XZ and YZ) on a single figure.</p>
  
  <p>Thanks for the help!</p>
  
  <p>-Dylan</p>
  
  <p>EDIT:
  Per @Andrew_L's suggestion, I modified this in my code:</p>
  
  <pre><code>sp1 = subplot(2,1,1);
         axes(sp1);
         axes1 = axes();
         grid(axes1,'on');
         view(axes1,[90 0]);
         msh = mesh(taux,fdy,z,'Parent',axes1);
  </code></pre>
  
  <p>This is repeated for the other subplot. The result is still the same, however. It appears to set up the two blank subplots properly and then display the full pseudo-3D plot over it.</p>