Xticklabel to split into two lines
147 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giuseppe Degan Di Dieco
am 10 Dez. 2021
Kommentiert: Star Strider
am 13 Dez. 2021
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 Kommentare
Akzeptierte Antwort
Star Strider
am 10 Dez. 2021
This has been updated to work in more recent releases.
.
2 Kommentare
Star Strider
am 13 Dez. 2021
As always, my pleasure!
I attempted to do something similar myself, then found this link and MathWorks’ solution, and just went with it.
.
Weitere Antworten (1)
Voss
am 10 Dez. 2021
Maybe this will work:
set(gca(),'XTickLabel',{'Concrete' 'Masonry' 'Steel' sprintf('Steel/concrete\\newlinecomposite')});
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!