File Exchange

image thumbnail

linkzoom.m v1.3 (Aug 2009)

Links the ZOOM and PAN regions of different axes.

1 Download

Updated 20 Aug 2009

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.

Usage:

>> 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 (2020). linkzoom.m v1.3 (Aug 2009) (https://www.mathworks.com/matlabcentral/fileexchange/21414-linkzoom-m-v1-3-aug-2009), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

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)

happy

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.

Hi Carlos. Fantastic function. Please check how I used it in here:
http://mycarta.wordpress.com/2011/11/29/image-processing-tips-for-geoscientists-part-1/

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.

Michelle

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!

Andres

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, http://www.mathworks.com/matlabcentral/fileexchange/9016 , 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.

Updates

1.3.0.0

v1.3 Fixed bug when using PLOTYY.

1.2.0.0

v1.2 Fixed small bug with ZOOM OUT and Double-Click. Other minor changes.

1.1.0.0

1) Fixed bug with already zoomed axes.
2) Changed the example.

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

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

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