Common xlabel and ylabel in a subplot of a subplot

27 ビュー (過去 30 日間)
Gab D
Gab D 2021 年 5 月 22 日
コメント済み: Gab D 2021 年 5 月 23 日
Hello,
I would like to obtain a figure of (for example) 2 by 2 subplot, but with the last figure being another 2 by 2 subplot. If possible, I would like to use tiledlayout and nexttile, since I can edit the space between the figures.
My problem is that I would like to specify the xlabel and ylabel differently for the 3 bigger graphs and one general xlabel and ylabel for the smaller subplot (see the example in attachment and below).
In a basic example, I am almost able to achieve my goal, but I don't know how to set the last x and y labels for the smaller subplot.
x=sin(linspace(1,10)); % Set randomly for the example.
figure(1); t=tiledlayout(4,4,'TileSpacing','normal','Padding','compact');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
% How to set global xlabel and ylabel for the remaining 4 graphs?
ax1 = nexttile;
plot(x)
ax2 = nexttile;
plot(x)
ax3 = nexttile;
plot(x)
ax4 = nexttile;
plot(x)
Thank you in advance for your help!

採用された回答

VBBV
VBBV 2021 年 5 月 22 日
x=sin(linspace(1,10)); % Set randomly for the example.
figure(1); t=tiledlayout(4,4,'TileSpacing','normal','Padding','compact');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
nexttile([2,2])
plot(x); xlabel('x'); ylabel('y');
% How to set global xlabel and ylabel for the remaining 4 graphs?
ax1 = nexttile;
plot(x);
ax2 = nexttile;
plot(x);
ax3 = nexttile;
plot(x);
ax4 = nexttile;
plot(x);
xlabel([ax3 ax4],'x'); ylabel([ax1 ax3],'y')
do you mean this ?
  1 件のコメント
Gab D
Gab D 2021 年 5 月 23 日
Hi, thank you for your answer.
This could work, but I had in mind a common 'x' and 'y' for the small quadrant. Something like:
If nothing comes to mind, I will use your example!

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

その他の回答 (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