title: Adding labels and axis to Surf in Matlab
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12821605/creating-surf-with-labels">Creating Surf() with Labels</a>  </p>
  </blockquote>
  
  
  
  <pre><code>title('Euro Swap Rates');
  
  xlabel('Maturity');
  
  ylabel('Date');
  
  zlabel('Swap Rate');
  
  set(gca, 'YTick', 1:100:length(dates));
  
  set(gca, 'YTickLabel', dates(1:100:length(dates))); 
  
  set(gca, 'XTick', 0:10:length(rates_header)); 
  
  set(gca, 'XTickLabel', rates_header(0:10:length(rates_header)));
  </code></pre>
  
  <p>Two questions remain: 
  1.
  2.</p>
  
  <ol>
  <li>I would like the <code>x</code> Tick to be <code>1y</code> then <code>10y20y...50y</code> So that the first step size is <code>9y</code> then <code>10y</code> for all remaining points, apart from the last <code>2</code> which are <code>55y</code> and <code>60y</code> and so should be spaced <code>5y</code> apart how can I handle this irregular spacing? </li>
  <li>I would like the dates to show the 1st of Jan and ist of June each year only (or the closest working days to those dates). (At the moment the code above just takes the length of the vector and splits it as instructed, I need someway where it can look at the values in the array and split accordingly.</li>
  </ol>
  
  <p>OK did it, seems a slightly cackhanded way to do it but its done</p>
  
  <pre><code>keydates={'01/01/2000','01/06/2000','01/01/2001','01/06/2001','01/01/2002','01/06/2002','01/01/2003','01/06/2003','01/01/2004','01/06/2004','01/01/2005','01/06/2005','01/01/2006','01/06/2006','01/01/2007','01/06/2007','01/01/2008','01/06/2008','01/01/2009','01/06/2009','01/01/2010','01/06/2010','01/01/2011','01/06/2011','01/01/2012','01/06/2012'};
   keydates2=datenum(keydates,'dd/mm/yyyy');
   dates2=datenum(dates,'dd/mm/yyyy');
   [index]=ClosestDate(dates2,keydates2);
   ytick = index;
   yticklabels = keydates;
   set(gca, 'YTick', ytick); 
   set(gca, 'YTickLabel', yticklabels);
  </code></pre>
  
  <p>ClosestDate is my function that finds the first date in dates2, that is more than each date in keydates2. </p>