Borrar filtros
Borrar filtros

Common xlabel and ylabel in a subplot of a subplot

38 visualizaciones (últimos 30 días)
Gab D
Gab D el 22 de Mayo de 2021
Comentada: Gab D el 23 de Mayo de 2021
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!

Respuesta aceptada

VBBV
VBBV el 22 de Mayo de 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 ?
  1 comentario
Gab D
Gab D el 23 de Mayo de 2021
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!

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by