Axes default zoom limit

7 ビュー (過去 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;
  1 件のコメント
Jaeseok
Jaeseok 2022 年 12 月 24 日
Very nice, Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by