Axis date values disappear when datetick is applied to a simple time-series plot
Mostrar comentarios más antiguos
Hello,
I'm creating a plot of time (x-axis) against flow rate (y-axis). Time is displayed in decimal format and I want to convert this to real dates in the format dd/mm. To do this I am using datetick, which normally works for me, but the result in this instance is that all values on the x-axis are removed with the exception of the first and last values (which are converted to dd/mm format). Seems simple.
figure; plot(Time,flowrate,'r.'); datetick('x','dd/mm');
Any suggestions to what I might be doing wrong would be greatly appreciated.
Respuesta aceptada
Más respuestas (1)
Oleg Komarov
el 7 de Sept. de 2011
Get used to set the properties for your plots, especially when you start adding a little bit of customization. My plots sometimes take the whole screen and I am not doing anything special apart from setting labels, ticks and manually subplotting.
An example:
time = now-99:now;
flow = cumsum(randn(100,1));
plot(time,flow,'r')
datetick('x','dd/mm');
% Set Xlim and ticks position
set(gca, 'Xlim',time([1,end]),'Xtick',linspace(time(1),time(end),9))
2 comentarios
Saul
el 7 de Sept. de 2011
Oleg Komarov
el 7 de Sept. de 2011
Without the actual data is hard to guess what is happening. I would be interested to know what your times is.
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!