Xticklabel to split into two lines
161 ビュー (過去 30 日間)
古いコメントを表示
Giuseppe Degan Di Dieco
2021 年 12 月 10 日
コメント済み: Star Strider
2021 年 12 月 13 日
Dear All,
hope you are doing well.
I'd very grateful if you cold help me in understanding how to split a label for a bar xtick into two lines.
As you can see from the attached plot, it happens that the string 'Steel/concrete composite' is too long, and I'd would have something like 'Steel/concrete' in the upper line, and 'composite' below, that is
Steel/concrete
composite
Thanks for your time and help in advance, and best!
---
Giuseppe
0 件のコメント
採用された回答
Star Strider
2021 年 12 月 10 日
This has been updated to work in more recent releases.
.
2 件のコメント
Star Strider
2021 年 12 月 13 日
As always, my pleasure!
I attempted to do something similar myself, then found this link and MathWorks’ solution, and just went with it.
.
その他の回答 (1 件)
Voss
2021 年 12 月 10 日
Maybe this will work:
set(gca(),'XTickLabel',{'Concrete' 'Masonry' 'Steel' sprintf('Steel/concrete\\newlinecomposite')});
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!