Multi-line x-tick label MATLAB bar graph
6 次查看(过去 30 天)
显示 更早的评论
How can I get my bar graphs 'A', 'B', 'C' to be multi-line strings? I would like to have two lines for each 'A', 'B', or 'C', but I don't know how to make newline in str, within set()
This is the working code I have so far:
x = [1 2 3];
str = {'A'; 'B'; 'C'};
bar(x)
set(gca, 'XTickLabel',str, 'XTick',1:numel(str))
And the output:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153794/image.jpeg)
Thanks.
0 个评论
采纳的回答
dpb
2014-7-30
Tick labels don't have TeX interpreter so no can do w/ them. Use text instead...altho you might search File Exchange for any enhanced tick-writing toolsets that may have already done for you.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!