Azzera filtri
Azzera filtri

Axes default zoom limit

4 visualizzazioni (ultimi 30 giorni)
Jaeseok
Jaeseok il 19 Dic 2022
Commentato: Jaeseok il 24 Dic 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 Commento
Suvansh Arora
Suvansh Arora il 23 Dic 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.

Accedi per commentare.

Risposta accettata

Suvansh Arora
Suvansh Arora il 23 Dic 2022
Modificato: Suvansh Arora il 23 Dic 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;

Più risposte (0)

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by