title: MATLAB: Plotting Time on Xaxis - overlapping label
body: <p>I am having difficulties on plotting time on the xaxis. I have some overlapping labels. See below:</p>
  
  <p><img src="https://i.stack.imgur.com/Hwoyi.jpg" alt="plot"></p>
  
  <p>This is my code:</p>
  
  <pre><code>time=datenum(0,0,0,0,0,timeinseconds);
  labs=1:10:length(time);
  
  figure(3);
  plotyy(time,xvalue,time,dens);
  datetick('x','HH:MM');
  set(gca,'XTick',time(labs),'XTickLabel',time(labs)); 
  legend('xval','CDF');
  title('Crash on Oct.10 2008 at 15:59pm');
  xlabel('Time');
  </code></pre>
  
  <p>First, why are the labels overlapping with the old ones? And secondly, how I can get the label to rotate 90degrees? I tried some other matlab functions to turn the labels but none seem able to tackle time format labels. </p>