删除Matlab图的刻度标签中的科学记数法

And*_*rew 11 matlab plot label

我在Matlab中制作了一个情节,使用:

hold on
plot(t1,Dx1,'r')
xlabel('t (ps)')
ylabel('Deviation of coordinate from initial coordinate (Å)')
plot(t1,Dy1,'g')
plot(t1,Dz1,'b')
hold off
Run Code Online (Sandbox Code Playgroud)

但是,y轴上的刻度标签是用科学记数法生成的:

y轴上的科学记数法

有什么方法可以删除科学记数法,并且y标签的范围是-0.0025到0.0005吗?谢谢!

rob*_*nce 10

您可以尝试使用sprintf自己手动设置刻度标签:

yt = get(gca,'YTick');
set(gca,'YTickLabel', sprintf('%.4f|',yt))
Run Code Online (Sandbox Code Playgroud)


GHH*_*GHH 5

在创建轴后尝试添加:

ax = gca;
ax.YAxis.Exponent = 0;
Run Code Online (Sandbox Code Playgroud)

下面是一个例子:

x = 0:0.1:10;
y = 1000*x.^2;

%Plot with default notation:

subplot(1,2,1)
plot(x,y)


%Plot without exponent:

subplot(1,2,2)
plot(x,y)
ax = gca
ax.YAxis.Exponent = 0;
Run Code Online (Sandbox Code Playgroud)