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

조회 수: 28 (최근 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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by