0

我想在我的函数中添加代码以围绕一个点进行缩放,同时保留稍后手动取消缩放的选项。

我可以使用set(gca,'xlim',[x1 x2]),但如果我稍后尝试使用放大镜恢复原始变焦,轴会“卡住”。

4

1 回答 1

0

Maybe not as elegant as you want, but you can store the original axis limits:

plot(rand(100));
xlim_orig = xlim();
ylim_orig = ylim();

% Zoom to point ...

% Do other stuff

% Zoom back out
xlim(xlim_orig)
ylim(ylim_orig)

Once you have "reset" the axes limits, the manual zoom and pan tools will work as expected.

于 2013-08-21T23:47:24.963 回答