Plot graph with different labels
5 views (last 30 days)
Show older comments
Hi,
I have a data set
y = [10,15,23];
x = {'jan','feb','mar'};
but obviously you cant plot Strings so i made a third array:
z=[1,2,3];
to represent the Strings. I would like to plot(z,y) but with x as the labels on the x axis (i dont want to see the numbers 1,2,3), how is this possible?
Also if I had 100 data points, how would i make it so only a few of the labels will be shown? thanks
0 Comments
Accepted Answer
Azzi Abdelmalek
on 27 Sep 2013
Edited: Azzi Abdelmalek
on 27 Sep 2013
y = [10,15,23];
x = {'jan','feb','mar'};
z=[1,2,3];
plot(z,y)
set(gca,'xtick',z,'xticklabel',x)
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!