Plot empties after using datetick
Ältere Kommentare anzeigen
I am trying to use datetick method to label one of the axes i have but when i use datetick, the ticks are displayed properly, but the plot area is cleared and plot vanishes. Here is a simplified example of what i am trying to do:
plot(rand(10));
startDate = datenum('01-01-2009');
endDate = datenum('12-31-2009');
xData = linspace(startDate,endDate,5);
set(gca,'XTick',xData);
datetick('x','dd-mmm','keepticks');
Any suggestions?
Thanks
1 Kommentar
Joe Wildman
am 21 Okt. 2016
Bearbeitet: Joe Wildman
am 21 Okt. 2016
Try this:
startDate = datenum('01-01-2009');
endDate = datenum('12-31-2009');
xData = linspace(startDate,endDate,5);
plot(xData,rand(5));
set(gca,'XTick',xData);
datetick('x','dd-mmm','keepticks');
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Axis Labels finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!