How to Create a Plot with a years on x-Axis
1 view (last 30 days)
Show older comments
sir i want to plot years on x-axis.it mean want (2006 to 2013) on xtick(x-axis).please help me. thank you in advance.
0 Comments
Answers (1)
Azzi Abdelmalek
on 18 May 2014
Edited: Azzi Abdelmalek
on 18 May 2014
Look at this example
t=0:0.01:10;
y=sin(t);
plot(t,y)
xl=get(gca,'xlim')
xt=linspace(xl(1),xl(2),2013-2006+1);
set(gca,'xtick',xt)
set(gca,'xticklabel',cellfun(@num2str,num2cell(2006:2013),'un',0))
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!