2019-02-16
阅读量:
4408
使用xlim后,将“重置为原始视图”缩小到整个范围
xlim在MATLAB中使用时,您设置的限制将成为“原始视图”。
这意味着右键单击缩放工具,选择“重置为原始视图”不会缩小到整个范围。
例如:
figure(1);
x = 0:0.1:6
plot( x, sin(x) ); % Example plot, x axis range [0, 6]
xlim( [2, 4] ); % 'Zoom' into the x axis range [2, 4]
% Limits are unchanged at [2, 4] when [0, 6] is desirable.






评论(1)


啊啊啊啊啊吖
2019-02-16
一种选择是使用未记录的命令resetplotview。
来自doc resetplotview:
限内部使用。在将来的版本中可能会删除此功能。
在xlim命令之前调用此函数。
figure(1);
x = 0:0.1:6
plot( x, sin(x) ); % Example plot, x axis range [0, 6]
resetplotview( gca, 'InitializeCurrentView' ) % Ensure we can reset the zoom
xlim( [2, 4] ); % 'Zoom' into the x axis range [2, 4]
这具有所需的结果,其中单击“重置为原始视图”缩小到x范围[0, 6],但最初显示的x范围是[2, 4]。
因为此函数未记录,所以具有内部的上下文可能是有用的。您可以edit resetplotview查看'InitializeCurrentView'选项的实现位置。从本质上讲,它可以setappdata用来定义'matlab_graphics_resetplotview'属性,特别是XLim属性为'auto'。如果resetplotview函数已折旧,您可以手动执行此操作。
0.0000
0
0
推荐帖子
0条评论
0条评论
0条评论