Multi-line x-tick label MATLAB bar graph

10 vues (au cours des 30 derniers jours)
AM
AM le 30 Juil 2014
Modifié(e) : Matt J le 26 Fév 2019
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.

Réponse acceptée

dpb
dpb le 30 Juil 2014
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.

Plus de réponses (0)

Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by