フィルターのクリア

zoom and view[90 90 ] problem on figure

6 ビュー (過去 30 日間)
Boissonneau
Boissonneau 2021 年 10 月 21 日
コメント済み: Boissonneau 2024 年 4 月 22 日
hi,
my problem : when i used view properties on axes, the zoom doesn't work well.
with this code, if i zoom on the third axes, the size of the plot increase, but there is no zoom action
thanks for your help
function TestZoomPlot
x = linspace(-5,5);
y = -1 * x.^2;
ax1 = subplot(2,2,1);
hz = zoom;
plot(x,[y ; y+1]);
title 'Axe 1';
set(ax1,'ButtonDownFcn',@click_1)
setAxesZoomMotion(hz,ax1,'horizontal');
ax3 = subplot(2,2,3);
plot(x,[y ; y+1]);
title 'Axe 3';
setAxesZoomMotion(hz,ax3,'Vertical');
set(ax3,'view',[90 90]);
ax4 = subplot(2,2,4);
plot(x,-[y ; y+1]);
title 'Axe 4';
%set(ax4,'ButtonDownFcn',@click_4)
end

回答 (1 件)

Rishav
Rishav 2024 年 4 月 15 日
Hi Boissonneau,
When you set the view of ax3 to [90 90], you are effectively looking at the plot from a top-down perspective, which can interfere with how MATLAB's zoom feature expects to manipulate the camera view and limits.
Here is a simpler adjustment to the code that maintains the use of MATLAB's built-in zoom functionality but removes the custom view setting that is causing the issue:
function TestZoomPlot
x = linspace(-5,5);
y = -1 * x.^2;
% First subplot
ax1 = subplot(2,2,1);
hz = zoom;
plot(x,[y ; y+1]);
title 'Axe 1';
set(ax1,'ButtonDownFcn',@click_1)
setAxesZoomMotion(hz,ax1,'horizontal');
% Third subplot
ax3 = subplot(2,2,3);
plot(x,[y ; y+1]);
title 'Axe 3';
setAxesZoomMotion(hz,ax3,'Vertical');
% Commented out to avoid zoom issues
% set(ax3,'view',[90 90]);
% Fourth subplot
ax4 = subplot(2,2,4);
plot(x,-[y ; y+1]);
title 'Axe 4';
end
The callback function click_1 is referenced but not fully implemented in the provided code. Ensure you have a suitable function defined to handle the click events in your application.
  1 件のコメント
Boissonneau
Boissonneau 2024 年 4 月 22 日
Thanks Rishav for your help, But the problem was to use the zoom tool with the view function, beacause i wanted to rotate the third axe...

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

カテゴリ

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

製品


リリース

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by