change location of y tick labels to the left or right of y axis
36 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Emily Pendleton
il 31 Ago 2020
Risposto: Emily Pendleton
il 1 Set 2020
Hello,
My y-axis is located at the origin for my hbar graph. The ytick labels are to the right of the y axis and I want to move them to the left. Is this possible?
Thanks.
2 Commenti
S. Walter
il 31 Ago 2020
Modificato: S. Walter
il 31 Ago 2020
I can't consistently reproduce the effect but if I try this:
b = barh(randn(10,1));
ax = gca;
ax.YAxisLocation = 'origin';
The marks appear on the left side:
However, sometimes, it moves it to the labels to the right side so it doesn't appear to be very robust.
The other method you could try is to use a text object.
b = barh(randn(10,1));
ax = gca;
ax.YAxisLocation = 'origin';
ax.YTickLabel =[];
for i = 1 :1 : 10
text(0,i,num2str(i),'HorizontalAlignment','right');
end
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!