Return to previous zoom level/location

4 vues (au cours des 30 derniers jours)
Anon
Anon le 25 Mar 2011
Commenté : Gary le 22 Déc 2015
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.

Réponse acceptée

Matt Fig
Matt Fig le 25 Mar 2011
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 commentaires
Anon
Anon le 26 Mar 2011
Thanks Matt!
Gary
Gary le 22 Déc 2015
What's the difference between what Anon did and what Matt Fig did?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Exploration dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by