Common xlabel and ylabel in a subplot of a subplot
34 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Akzeptierte Antwort
VBBV
am 22 Mai 2021
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 ?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!