Link All Axes in Figure
Version 1.0.0.0 (1.34 KB) by
Dan K
This is just a simple utility function to find all subplots in a figure and link their axes.
Syntax is the same as linkaxes, except without passing in the handles to the axes to link. It replaces:
figure;
ax(1) = subplot(2,1,1);
plot(rand(10,1));
ax(2) = subplot(2,1,2);
plot(1:10);
linkaxes(ax,'x')
clear ax
with:
figure;
subplot(2,1,1);
plot(rand(10,1));
subplot(2,1,2);
plot(1:10);
linkaxesInFigure('x')
Cite As
Dan K (2025). Link All Axes in Figure (https://uk.mathworks.com/matlabcentral/fileexchange/34476-link-all-axes-in-figure), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2011b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Subplots in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
