【发布时间】:2017-04-04 06:37:31
【问题描述】:
我一直在绘制一些数字,我想在某些区域放大多次保存它们。除了最后一个视图之外,我所有的视图都有 y=0 的轴心点。我一直在使用“XLim”来更改 X 轴上的视图。现在我需要在 Y 轴上平移视图。使用 YLim 时,图像的纵横比会发生变化。
是否可以在 Y 轴上设置一些枢轴点?
这是可以看到我的问题的最低工作代码。暂停 2 次。
f1 = figure(10);
hold on
axis equal
x = linspace(1,2*pi);
y = sin(x);
plot(x,y,'*')
xlims=[0 2*pi; 1 2*pi; 0.5 1.5];
for i = 1:size(xlims,1)
set(gca,'XLim',xlims(i,:))
disp('Here I am saving this view! (Paused)')
pause
end
% Now I want to PAN the Y axis and set the view around Y = 1.
% But still keep last set Xlims AND keep the aspect ratio of figure.
% When using YLim, the aspect ratio changes.
set(gca,'YLim',[0.9 1.1]) % Not what I have in mind.
% Just need to pivot Y=1...
【问题讨论】:
-
set(gca, 'YLim', get(gca, 'YLim')+dy)有什么问题? -
这非常完美!非常感谢...为什么我没有想到获取当前的 'ylims' 并更改并添加 y 的更改。