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)
Carlos Adrian Vargas Aguilera (2021). linkzoom.m v1.3 (Aug 2009) (https://www.mathworks.com/matlabcentral/fileexchange/21414-linkzoom-m-v1-3-aug-2009), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
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.
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/
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, http://www.mathworks.com/matlabcentral/fileexchange/9016 , without the need to replace the original zoom function.
Thank you Carlos Adrian!
Nothing more to say here than - well done.
It works.