MATLAB Function Reference |
Synchronize limits of specified 2-D axes
Syntax
Description
Use linkaxes to synchronize the individual axis limits on different subplots within a figure. Calling linkaxes will make all input axis have identical limits. This is useful when you want to zoom or pan in one subplot and display the same range of data in another subplot.
linkaxes(axes_handles)
links the x- and y-axis limits of the axes specified in the vector axes_handles
.
linkaxes(axes_handles,'
Links the axes option
')
axes_handles
according to the specified option. The option
argument can be one of the following strings:
See the linkprop
function for more advanced capabilities that allows linking object properties on any graphics object.
Example
This example creates two subplots and links the x-axis limits of the two axes. You can use interactive zooming or panning (selected from the figure toolbar) to see the effect of axes linking. For example, pan in one graph and notice how the x-axis also changes in the other.
ax(1) = subplot(2,2,1); plot(rand(1,10)*10,'Parent',ax(1)); ax(2) = subplot(2,2,2); plot(rand(1,10)*100,'Parent',ax(2)); linkaxes(ax,'x');
See Also
LineSpec | linkprop |
© 1994-2005 The MathWorks, Inc.