How to format YTickLabel with x10^n on when plotting a figure?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Albert Bing
am 24 Mär. 2016
Beantwortet: Sean de Wolski
am 8 Jan. 2018
How to set the decimal digits of YTickLabel in figure? I tried some ways, but numbers with '%.4f' was too long, numbers with '%.2e' not good, either.
The following figure may be helpful for my question.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158719/image.png)
The left one uses
set (gca, 'YTickLabel', num2str (get (gca, 'YTick').' , '%.4f) )
The central one uses
set (gca, 'YTickLabel', num2str (get (gca, 'YTick').' , '%.2e) )
And the right one uses the default settings.
What I really want is as following figure.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158720/image.png)
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 8 Jan. 2018
y = rand(10,1)*5000;
ax = axes;
plot(y)
ax.YAxis.Exponent = 3;
0 Kommentare
Weitere Antworten (1)
Danesh Bankwala
am 8 Jan. 2018
Bearbeitet: Danesh Bankwala
am 8 Jan. 2018
Did you ever figure this out? I have a similar problem.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!