The farthest yticklabels do not appear when using ax.YAxisLocation = 'origin'
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
The two farthest ytickslabels (in this case both -1 and +1), do not show up if I use ax.YAxisLocation = 'origin'
x=-1:0.1:1;
plot(x,x,'o-')
ax=gca;
ax.YAxisLocation = 'origin';
set(ax,'fontsize',20)
yticks([-1 -0.5 0 0.5 1])
Is there a way to show them without playing with ylim([-2 2]) as here below?
x=-1:0.1:1;
plot(x,x,'o-')
ax=gca;
ax.YAxisLocation = 'origin';
set(ax,'fontsize',20)
yticks([-1 -0.5 0 0.5 1])
ylim([-2 2])
0 Commenti
Risposta accettata
Les Beckham
il 24 Giu 2024
I'm not sure this is much more satisfactory than your approach, but it appears to at least work and would adapt to different y axis ranges.
It's interesting that the 'ylimitmethod' and 'xlimitmethod' work differently for their default values of 'tickaligned'. Maybe because the x labels are outside the axis and thus have more room to be displayed.
x=-1:0.1:1;
plot(x,x,'o-')
grid on
ax=gca;
ax.YAxisLocation = 'origin';
set(ax,'fontsize',20)
yticks([-1 -0.5 0 0.5 1])
set(gca, 'ylimitmethod', 'padded')
% ylim([-2 2])
2 Commenti
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!