- Default axes limits seems to have changed after step-3, refer the attached fig for reference.
- What difficulties are you facing in achieving the attached results.
Axes default zoom limit
6 次查看(过去 30 天)
显示 更早的评论
%% 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
2022-12-23
In order to understand this better, I would need the following information:
采纳的回答
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 Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!