View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Linked Pan and Zoom

Be the first to rate this file! 4 Downloads (last 30 days) File Size: 6.59 KB File ID: #26282 Version: 1.21

Linked Pan and Zoom



05 Jan 2010 (Updated )

Pans and zooms multiple axes on the same figure, with full control of axes linking.

| Watch this File

File Information

Pan with left click mouse drag, draw a zoombox with right click drag, and view all data with double-click. This also retains any existing WindowButtonXFcn the figure has, as well as any axes UIContextMenus.
I wrote this for live data capture, as linkaxes sets XLimMode to "manual" - which means the axes wouldn't automatically resize for new data.
panzoom(figureHandle, axesHandles)
Adds the functionality to that figure, ONLY to the axes handles specified.
panzoom(figureHandle, axesHandles, xLink)
panzoom(figureHandle, axesHandles, xLink, yLink)
Assuming you have four axes handles: 1, 2, 3, 4. You could link all of the x axes together: xLink = [1, 2, 3, 4], or you could link them in pairs in a cell array: xLink = {[1, 2], [3, 4]}. The same applies for yLink. xLink or yLink can also be empty.

MATLAB release MATLAB 7.1.0 (R14SP3)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
10 May 2011 Joseph

Joseph (view profile)

This did not work for me.

First, in line 110, I believe there is an error 'oget' should be 'get'.

After I changed that, I received the following error, it could not find the referenced function 'getposition':

??? Undefined function or method 'getposition' for input arguments of type 'double'.

Error in ==> panzoom>windowButtonDownFcn at 152
axesPositions = getposition(axesHandles, 'pixels');

??? Error while evaluating figure WindowButtonDownFcn

Comment only
10 May 2011 1.1

Fixed the "oget" error, and added back in a dependency for the helper function "getposition" (yes I know, very sloppy).

05 Nov 2015 1.2

Fixed getposition so it works properly with the new handle graphics system. Have not tested the other components yet.

24 Aug 2016 1.21

Bugfix for compatibility with later MATLAB versions (post-HG2)

Contact us