Multi-line x-tick label MATLAB bar graph
조회 수: 8 (최근 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:
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에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!