YTickFormat with no exponential notation

Is there a way I can force YTickFormat to not use scientific notation? I've tried using ytickformat('%.1f'), but it shows 1.0 x 10^4 instead of 10000.0 on the axis if the axis value is equal to or greater than 10000.

 採用された回答

dpb
dpb 2025 年 3 月 25 日
編集済み: dpb 2025 年 3 月 25 日

0 投票

subplot(2,1,1)
x=linspace(0,1E5);
y=randn(size(x));
plot(x,y)
hAx=subplot(2,1,2);
plot(x,y)
hAx.XAxis.Exponent=0;
I don't recall when Mathworks introduced the Exponent property to the axes; but you can forcibly turn it off.
NOTA BENE that Exponent is a property of the [X|Y|Z]Axis and is not visible from just the hAx handle.
NOTA BENE SECOND: Unless later versions have fixed it, the mode with a datetime or duration axis is not exposed; one has to make a subterfuge fixup to remove the equivalent there of the date if only want the times on the axis visible.

1 件のコメント

Felipe Dicker
Felipe Dicker 2025 年 3 月 25 日
Just what I needed, thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAxes Appearance についてさらに検索

製品

リリース

R2024b

質問済み:

2025 年 3 月 25 日

コメント済み:

2025 年 3 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by