How Do I Remove Scientific Notation From X/Y Axes on Plot

30 ビュー (過去 30 日間)
BP
BP 2022 年 3 月 18 日
回答済み: Star Strider 2022 年 3 月 18 日
I do not want MATLAB to put the X10 scientific notation at the top of the Y axis ao at the right side of the X axis.
I have tried to using:
ax.XAxis.Exponent = 0
and
ax = gca;
ax.XRuler.Exponent = 0;
This has not worked. The best it will do is turn the numbers on the x axis to something like 0.000001 0.000003 ect.
I need it to just put 1 3 5 etc and let me note the notation in the x and y titles.
In other words, I want it to leave the numbers is is putting beside the X and Y axis but not put the X10^3 and X10^-6 at the ends of the X and Y axis lines.
Can you help?
Thanks,

回答 (2 件)

Voss
Voss 2022 年 3 月 18 日
Multiply your data by the appropriate factor.
x = (1:10)*1e-6;
y = (1:10)*1e-3;
figure();
plot(x,y); % original plot, with exponents
xlabel('x');
ylabel('y');
figure();
plot(x*1e6,y*1e3); % new plot with data scaled appropriately
xlabel('x (*1e-6)');
ylabel('y (*1e-3)');

Star Strider
Star Strider 2022 年 3 月 18 日
Perhaps something like this —
x = logspace(-6, -2, 250);
y = sin(2*pi*3*x/x(end));
figure
semilogx(x, y)
grid
figure
semilogx(x, y)
grid
Ax = gca;
xt = Ax.XTick;
Ax.XTickLabel = log10(xt);
.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by