How to format YTickLabel with x10^n on when plotting a figure?

6 ビュー (過去 30 日間)
Albert Bing
Albert Bing 2016 年 3 月 24 日
回答済み: Sean de Wolski 2018 年 1 月 8 日
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.
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.

採用された回答

Sean de Wolski
Sean de Wolski 2018 年 1 月 8 日
y = rand(10,1)*5000;
ax = axes;
plot(y)
ax.YAxis.Exponent = 3;

その他の回答 (1 件)

Danesh Bankwala
Danesh Bankwala 2018 年 1 月 8 日
編集済み: Danesh Bankwala 2018 年 1 月 8 日
Did you ever figure this out? I have a similar problem.

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by