I've enabled pan and zoom for a figure but I can only zoom in the figure. How do I pan?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I can click and draw a box for a region to zoom in on on the axes window but I can't pan.
close(findall(0,'type','figure','name','EX_ginputWithInteractiveAxes'));
xLbl = 'x-Axis';
yLbl = 'y-Axis';
posSize = [.054 .555 .49 .4];
f = figure('Name','EX_ginputWithInteractiveAxes','NumberTitle','off');
axes_obj = axes('Parent', f, 'Units', 'normalized', 'Position', [posSize(1) posSize(2) posSize(3) posSize(4)],... % Create axes on the desired tab
'Box', 'on', 'XAxisLocation', 'bottom', 'YAxisLocation', 'left','XGrid', 'on', 'YGrid', 'on');
axes_obj.Title.String = 'Path Window';
axes_obj.XLabel.String = sprintf('%s', xLbl); % Put label on X axis
axes_obj.YLabel.String = sprintf('%s', yLbl); % Put label on Y axis
axes_obj.XLim = [-50 50];
axes_obj.YLim = [-50 50];
axes_pan = pan(ancestor(f,'figure'));
axes_pan.Enable = 'on'; % Enable panning for this figure
axes_pan.Motion = 'both'; % Enable vert & horz panning
% Enable Zoom
zoom_obj = zoom(ancestor(f,'figure'));
zoom_obj.Enable = 'on';
zoom_obj.Motion = 'both';
0 Kommentare
Antworten (1)
Walter Roberson
am 9 Sep. 2015
Zoom and pan are mutually exclusive, since they use the mouse clicks to mean different things.
2 Kommentare
Walter Roberson
am 9 Sep. 2015
You can always program them yourself using callbacks for clicks and mouse motion, if you can come up with an unambiguous set of actions.
The current panning control involves clicking and dragging which changes the xlimit or ylimit axes properties while keeping the difference between the upper and lower limits constant. The xlimit and ylimit properties determine which portion of the data is to be made visible.
The current zoom control involves clicking and dragging to outline a box to be zoomed in on, by setting the xlimit or ylimit axes properties to reflect the coordinates clicked and released at.
There is a defined click/release behaviour for zoom which zooms by a fixed factor near the coordinates clicked at. It would not be entirely inconsistent to say that clicking and releasing in the image was to indicate zooming but that click and drag was to indicate pan. It is possible to come up with consistent and potentially useful behaviour. But with the existing zoom and pan control the meaning of click and drag is different between the two.
Siehe auch
Kategorien
Mehr zu Visual Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!