Axes default zoom limit

6 vues (au cours des 30 derniers jours)
Jaeseok
Jaeseok le 19 Déc 2022
Commenté : Jaeseok le 24 Déc 2022
%% 1) create axes and 2d plot
haxes = axes;
xvec1 = linspace(1,100,10);
yvec1 = linspace(1,100,10);
xvec2 = linspace(1,10,10);
yvec2 = linspace(0,10,10);
himg = imagesc(haxes, xvec1, yvec1, rand(10,10));
set(himg, 'XData', xvec2, 'YData', yvec2)
%% 2) manipulate plot using interactive zoom tool of axes
%% 3) set new axes lim
set(haxes, 'XLim', [xvec2(1),xvec2(end)], ...
'YLim', [yvec2(1),yvec2(end)]);
I expected that default zoom buttom goes to new axes limits after step-3, but, it doesn't.
Default zoom button makes plot image fit to axes limits in step-1.
How do I update default zoom parameters? XLim, YLim never works.
Thank you.
  1 commentaire
Suvansh Arora
Suvansh Arora le 23 Déc 2022
In order to understand this better, I would need the following information:
  1. Default axes limits seems to have changed after step-3, refer the attached fig for reference.
  2. What difficulties are you facing in achieving the attached results.

Connectez-vous pour commenter.

Réponse acceptée

Suvansh Arora
Suvansh Arora le 23 Déc 2022
Modifié(e) : Suvansh Arora le 23 Déc 2022
To manually update the view of MATLAB figure window with latest 'xlim' and 'ylim', use the 'zoom reset' MATLAB command as part of step-3. Follow the code snippet mentioned below for reference:
%% 1) create axes and 2d plot
haxes = axes;
xvec1 = linspace(1,100,10);
yvec1 = linspace(1,100,10);
xvec2 = linspace(1,10,10);
yvec2 = linspace(0,10,10);
himg = imagesc(haxes, xvec1, yvec1, rand(10,10));
set(himg, 'XData', xvec2, 'YData', yvec2)
%% 2) manipulate plot using interactive zoom tool of axes
%% 3) set new axes lim
set(haxes, 'XLim', [xvec2(1),xvec2(end)], ...
'YLim', [yvec2(1),yvec2(end)]);
zoom reset;
  1 commentaire
Jaeseok
Jaeseok le 24 Déc 2022
Very nice, Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by