Scientific notation at y-axis with "ax.YAxis.Exponent"
Show older comments
I want to change the notation of the log y-axis:

Here is an example code, which doesn't work:
y = [0.1 0.3 0.5 1];
figure(1),
plot(y)
yticks([0.1 0.5 1])
set(gca,'yscale','log')
ax = gca;
ax.YAxis.Exponent = 2
I found out that exponent notation doesn't work when yticks is used in conjunction with logarithmic scaling.
Any ideas???
Accepted Answer
More Answers (1)
dpb
on 11 Jun 2021
I don't see a user-settable format to force the notation (although I didn't use Yair's getundoc to poke) with arbitrary tick values but
yticks(10.^(-1:1))
will trigger redrawing with the desired notation.
It's having intermediate tick labels that causes the switch.
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
