Axes default zoom limit

9 次查看(过去 30 天)
Jaeseok
Jaeseok 2022-12-19
评论: Jaeseok 2022-12-24
%% 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 个评论
Suvansh Arora
Suvansh Arora 2022-12-23
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.

请先登录,再进行评论。

采纳的回答

Suvansh Arora
Suvansh Arora 2022-12-23
编辑:Suvansh Arora 2022-12-23
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;

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by