zoom and view[90 90 ] problem on figure
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Rishav
el 15 de Abr. de 2024
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.
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!