Is it possible to change label names in Matlab
Afficher commentaires plus anciens
I want to have different names in my Y axis rather than numbering like the following photo:

Réponse acceptée
Plus de réponses (3)
Sean de Wolski
le 24 Juin 2015
Adjust the axes' 'YTickLabel' property:
barh(rand(3,1));
ax = gca;
ax.YTickLabel = {'Hello','World','Wednesday'}
1 commentaire
Moe
le 24 Juin 2015
Chad Greene
le 24 Juin 2015
plot(1:9,1:9)
set(gca,'ytick',1:9,'yticklabel',{'book','pen','vb','top','red','green','black','green','verb'})
Azzi Abdelmalek
le 24 Juin 2015
t=0:10;
y=sin(t)
plot(y)
s={'a' 'b' 'c' 'd' 'e' 'f'}
yt=get(gca,'ytick')
n=numel(s)
set(gca,'xtick',linspace(min(yt),max(xt),n),'yticklabel',s')
Catégories
En savoir plus sur Labels and Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
