说我有以下Matlab代码:
figure; a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(a,'ydata',1:10); %C在(A)我的情节的垂直范围是[1,10]。 在(B)我的情节的垂直范围是[0,20]。 在(C)处,垂直范围再次[1,10]。
我喜欢该图从步骤(A)到(B)自动缩放。 我不喜欢从(B)到(C)的自动缩放 - 它让事情跳得太多了。
有没有办法设置情节的规模扩大但从不收缩?
在我看来,这看起来像:
set(gca,'XLimMode','auto_maxever');Say I have the following Matlab code:
figure; a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(a,'ydata',1:10); %CAt (A) the vertical range of my plot is [1,10]. At (B) the vertical range of my plot is [0,20]. At (C), the vertical range is once again [1,10].
I like that the plot auto-scales from step (A) to (B). I don't like the auto-scaling from (B) to (C) - it makes things jump around too much.
Is there a way to have set the plot's scale to expand but never shrink?
In my mind, this looks like:
set(gca,'XLimMode','auto_maxever');最满意答案
据我所知,Matlab没有你描述的功能,但是...
您可以通过执行以下命令准确设置X和Y的限制:
set(gca,'XLim',[x1 x2], 'YLim',[y1 y2]);同一命令的快速别名是:
axis([xmin xmax ymin ymax]);您可以通过将XLimMode和YLimMode从Auto更改为Manual来随时“冻结”限制:
figure(); a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(gca,'XLimMode','manual'); set(gca,'YLimMode','manual'); set(a,'ydata',1:10); %C或者您可以使用另一个别名,它完全相同:
axis('manual');如果要连续采集数据,请考虑在每次更新前保存轴限制,然后执行手动缩放。
To my knowledge, Matlab does not have a function such as you describe, however...
You can set exactly the limits of X and Y by doing the following command:
set(gca,'XLim',[x1 x2], 'YLim',[y1 y2]);A quick alias for the very same command is:
axis([xmin xmax ymin ymax]);You might as well "freeze" the limits at any moment you like, by changing the XLimMode and YLimMode from Auto to Manual:
figure(); a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(gca,'XLimMode','manual'); set(gca,'YLimMode','manual'); set(a,'ydata',1:10); %COr you can use yet another alias, which does exactly the same:
axis('manual');If data is being continuously acquired, consider saving the axis limits before each update and then performing manual scaling.
在Matlab中防止激进的自动缩放(Prevent aggressive auto-scaling in Matlab)说我有以下Matlab代码:
figure; a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(a,'ydata',1:10); %C在(A)我的情节的垂直范围是[1,10]。 在(B)我的情节的垂直范围是[0,20]。 在(C)处,垂直范围再次[1,10]。
我喜欢该图从步骤(A)到(B)自动缩放。 我不喜欢从(B)到(C)的自动缩放 - 它让事情跳得太多了。
有没有办法设置情节的规模扩大但从不收缩?
在我看来,这看起来像:
set(gca,'XLimMode','auto_maxever');Say I have the following Matlab code:
figure; a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(a,'ydata',1:10); %CAt (A) the vertical range of my plot is [1,10]. At (B) the vertical range of my plot is [0,20]. At (C), the vertical range is once again [1,10].
I like that the plot auto-scales from step (A) to (B). I don't like the auto-scaling from (B) to (C) - it makes things jump around too much.
Is there a way to have set the plot's scale to expand but never shrink?
In my mind, this looks like:
set(gca,'XLimMode','auto_maxever');最满意答案
据我所知,Matlab没有你描述的功能,但是...
您可以通过执行以下命令准确设置X和Y的限制:
set(gca,'XLim',[x1 x2], 'YLim',[y1 y2]);同一命令的快速别名是:
axis([xmin xmax ymin ymax]);您可以通过将XLimMode和YLimMode从Auto更改为Manual来随时“冻结”限制:
figure(); a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(gca,'XLimMode','manual'); set(gca,'YLimMode','manual'); set(a,'ydata',1:10); %C或者您可以使用另一个别名,它完全相同:
axis('manual');如果要连续采集数据,请考虑在每次更新前保存轴限制,然后执行手动缩放。
To my knowledge, Matlab does not have a function such as you describe, however...
You can set exactly the limits of X and Y by doing the following command:
set(gca,'XLim',[x1 x2], 'YLim',[y1 y2]);A quick alias for the very same command is:
axis([xmin xmax ymin ymax]);You might as well "freeze" the limits at any moment you like, by changing the XLimMode and YLimMode from Auto to Manual:
figure(); a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause(); set(gca,'XLimMode','manual'); set(gca,'YLimMode','manual'); set(a,'ydata',1:10); %COr you can use yet another alias, which does exactly the same:
axis('manual');If data is being continuously acquired, consider saving the axis limits before each update and then performing manual scaling.
发布评论