How can I title my bar graph in x-axis?
59 次查看(过去 30 天)
显示 更早的评论
Hey,
As you know the default for x-axis in the Bar graph is just numbers. Could you please give me a hint how I can replace them by names? e.g. I would like to have a bar graph with the names of months (Jan, Feb, Mar, ...)in the x-axis.
Thank you,
Mehdi
0 个评论
采纳的回答
Grzegorz Knor
2011-9-30
I have no idea why. This code should work:
figure
name = {'m1';'m2';'m3';'m4';'m5'};
x = [1:5]; y = [19,24,42,12,14];
bar(x,y)
set(gca,'xticklabel',name)
2 个评论
Philippe Corner
2018-1-26
Hi Grzegorz Knor, how could i name the xbars in a sequence.. for example to have numbers from 1:1:10.
更多回答(2 个)
Grzegorz Knor
2011-9-30
bar(1:12)
set(gca,'xticklabel',{'a','b','c','d','e','f','g','h','i','j','k','l'})
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!