File Exchange

image thumbnail

linkzoom.m v1.3 (Aug 2009)

version (4.08 KB) by Carlos Adrian Vargas Aguilera
Links the ZOOM and PAN regions of different axes.

1 Download

Updated 20 Aug 2009

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

LINKAXES links the axis limits of several axes. LINKZOOM links the ZOOM and PAN regions ignoring the axes limits, then, it can be used to link several axes with different limits.


>> subplot(311)
>> ...
>> subplot(312)
>> ...
>> subplot(313)
>> ...
>> linkzoom % links all axes on current figure!

and that's it. Make a zoom or a panning of any of the axes and the others will do the same!

Other options are the figure or axes handles and the axis to be linked: 'x' or 'y' or both 'xy' (default).

By now the panning is actualized on all axes until the mouse is released :P, any help?

Check out the included example to notice the difference with LINKAXES.

(Bugs reports and suggestions will be very appreciated)

Cite As

Carlos Adrian Vargas Aguilera (2021). linkzoom.m v1.3 (Aug 2009) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Josh Zimmerman

this file works great, but you have to make sure your axes sizes are the same. If you use a function like multiplotyyy with this which creates different sized axis it will skew the x axis in the zooming. (see jsplotys.m which is a is similar to multiplotyyy.m, but lets you use linkzoom.m)


Hi Carlos. I like your function, but it is not working 'correctly' when using a plot with more than two y-axes, like produced with the function 'ploty4' (can be downloaded on file exchange). Here the plots in different axes are drawn away from each other. Suppose that two lines y1(x) and y2(x) are crossing at a special point (x0,y1(x0)=y2(x0)). If I zoom on the plot in the axes of y1 at the point, (x0,y1(x0)) The lines will not cross anymore. 'linkzoom' moves the axes differently.

Matteo Niccoli

Hi Carlos. Fantastic function. Please check how I used it in here:

David C

This works great, but I'm getting errors at the prompt when running this:
Undefined function or method 'getProxyValueFromHandle'
for input arguments of type 'double'.
Maybe I'm running a newer version (2011a). Any help would be appreciated.


Thank you. Finally, a way to zoom in on multiple axes at once, regardless of whether the axes have different x and y limits from one another. I have been looking for just such a solution for weeks!


Very very good! Just when I needed such a function, linkzoom appeared as the Pick of the Week. As I mentioned there, it works well with addaxis, , without the need to replace the original zoom function.
Thank you Carlos Adrian!

John D'Errico

Nothing more to say here than - well done.

An User

It works.

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: tlabel.m v2.6.1 (Sep 2009)

Inspired: addaxes.m v1.1 (Sep 2009)

Community Treasure Hunt

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

Start Hunting!