Display dates on x axis
1 次查看(过去 30 天)
显示 更早的评论
Hello everybody,
I wuold like to change time interval in the x axis every two years instead of every five years.
Thank you very muchbin advance
0 个评论
采纳的回答
Cris LaPierre
2021-7-12
2 个评论
Cris LaPierre
2021-7-12
We need to know what your x data looks like to give a solution specific to you. Is your x data already a datetime?
% spaced every 5 years
x = datetime(1990,1,1):years(1):datetime(2021,1,1);
y = rand(1,length(x));
plot(x,y)
% Use xticks to space every 2 years
figure
plot(x,y)
xticks(x(1):years(2):x(end))
xtickformat('yyyy')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!