How to set the axis to display hours?
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
How can I make the datetick count from 00:00 to 23:59. This below is dispalying 00:00 for every hour.
d= datetime(start_date):1/24:datetime(end_date)+1;
hours=hour(d);
scatter(hours,rand(size(d)));
t=datenum(d);
ax=gca;
ax.XTick=1:24;
datetick(ax,'x','HH:MM','keeplimits','keepticks')
0 comentarios
Respuestas (1)
  Guillaume
      
      
 el 26 de Feb. de 2015
        The XTick values need to be date number for datetick to work, so maybe:
ax.XTick = ceil(ax.XLim(1)):1/24:floor(ax.XLim(2));
datetick(ax,'x','HH:MM','keeplimits','keepticks');
5 comentarios
  Guillaume
      
      
 el 27 de Feb. de 2015
				Yes, there was a typo, missing a bracket which you added in the wrong place. I've corrected my answer
Ver también
Categorías
				Más información sobre Annotations en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
