Effacer les filtres
Effacer les filtres

Adding label to axis ticks

2 vues (au cours des 30 derniers jours)
Yi-xiao Liu
Yi-xiao Liu le 30 Sep 2020
Commenté : Yi-xiao Liu le 2 Oct 2020
How do I add labels next to the 3 180 xticks? Like sampleA for the first one, sampleB for the second, etc. Thanks!
>> xt = xticks
xt =
Columns 1 through 5
0 180 360 450 630
Columns 6 through 9
810 900 1080 1260
>> xtl=xticklabels
xtl =
9×1 cell array
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}
  1 commentaire
madhan ravi
madhan ravi le 30 Sep 2020
xticklabels('SampleA, ...) %?

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 30 Sep 2020
Modifié(e) : Adam Danz le 1 Oct 2020
Set the XTickLabel propery of the axis. Use newline to break apart a string into multiple lines.
Quick demo:
ax = cla();
ax.XLim = [0,4];
ax.XTick = 1:3;
ax.XTickLabel{2} = '180\newline A';
"\newline" inserts a line break within the label.
  1 commentaire
Yi-xiao Liu
Yi-xiao Liu le 2 Oct 2020
Yep this works. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by