Return to previous zoom level/location

9 次查看(过去 30 天)
Let's say I have created a figure using imagesc
imagesc(X(1,:),Y(:,1),I)
and I have then used the manual zoom tool to look at a particular region in the plot. I then do some changes to I (e.g. I2 = imdilate(I,ones(3))) and plot it again, say
imagesc(X(1,:),Y(:,1),I2)
and I want to zoom at the same extent again. What would be best practice to do so?
So far I tried to employ the Xlim and Ylim axis properties, such that
imagesc(X(1,:),Y(:,1),I); % zoom in somewhere manually
b = get(gca,'Xlim');
c = get(gca,'Ylim');
and then
imagesc(X(1,:),Y(:,1),I2)
set(gca,'Xlim',b,'Ylim',c)
but this won't allow me to zoom out afterwards.

采纳的回答

Matt Fig
Matt Fig 2011-3-25
Here is an example.
load clown
image(X)% Now zoom in on the eye.
% After zooming in, do this:
.
.
L = get(gca,{'xlim','ylim'}); % Get axes limits.
X = ind2rgb(X,map);
image(X)
zoom reset
set(gca,{'xlim','ylim'},L)
% Now the plot should be zoomed in around the eye again, but you can also zoom out.
  2 个评论
Gary
Gary 2015-12-22
What's the difference between what Anon did and what Matt Fig did?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by