plot of a string vector vs numeric vector
42 次查看(过去 30 天)
显示 更早的评论
I wonder how to make a plot as X-axis is a text vector. I get an error when I run the folloing code (??? Error using ==> plot Invalid first data argument). I apperciate your help.
y=[1 2 3 4 5 6]
x=['a','b','c','d','e','f']
plot(x,y)
1 个评论
采纳的回答
Matt Fig
2011-6-24
y=[1 2 3 4 5 6]
x=['a','b','c','d','e','f']
plot(y)
set(gca,'xticklabel',x.')
2 个评论
Christine Abou Nasr
2017-4-13
Hello! and if I want to select just a part of the x table, how can I do? For example, I would like to plot x values 'b' to 'e'. Thank you!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!