Workaround for linking separate axes without breaking the first link?

2 ビュー (過去 30 日間)
Amanda Beatty
Amanda Beatty 2021 年 4 月 27 日
コメント済み: Amanda Beatty 2021 年 4 月 28 日
I have a 2x6 plot created using panel.m from file exchange. It will always be two rows, but it will be an undetermined number of columns (if that matters). I want all of them to have linked x-axes, then I want the bottom row to have linked y-axes and the top row to have linked y-axes. Per the documentation of linkaxes() if I try to link separate axes it cancels out the first link. Is there a workaround for this?

採用された回答

Hyeokjin Jho
Hyeokjin Jho 2021 年 4 月 28 日
ax(1) = subplot(2,2,1);
ax(2) = subplot(2,2,2);
ax(3) = subplot(2,2,3);
l1 = linkprop(ax([1,2]),'ylim');
l2 = linkprop(ax([1,3]),'xlim');
  1 件のコメント
Amanda Beatty
Amanda Beatty 2021 年 4 月 28 日
Omg that worked. I tried linkprop earlier and it was giving me an error, but maybe my syntax was just wrong. Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by