How link axes horizontally in subplots?

7 ビュー (過去 30 日間)
SL
SL 2016 年 10 月 25 日
回答済み: Jiro Doke 2016 年 10 月 25 日
Code
f = figure();
bFig(1:10) = axes(f);
for k = 1:numel(bFig)
bFig(k) = subplot(5,2,k);
end
for i=1:5
linkaxes([bFig(1*i), bFig(2*i)], 'x');
end
Output: 5x2 subplot i.e. 10 figures, but the linkaxes works as asynchronously; not row-wise; something strange linking there too which I do not understand.
I would like to understand how to set it up correctly, and if there is anything wrong in declaring `linkaxes` before plotting the graphs to them.
MATLAB: 2016b

採用された回答

Jiro Doke
Jiro Doke 2016 年 10 月 25 日
I think what you want is this. Note the indexing using inside linkaxes.
f = figure();
bFig(1:10) = axes(f);
for k = 1:numel(bFig)
bFig(k) = subplot(5,2,k);
end
for i=1:5
linkaxes([bFig(i*2-1), bFig(i*2)], 'x');
end

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by