3 subplots with the bottom one split in 2 vertically?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
HC98
el 26 de Mzo. de 2023
Comentada: Star Strider
el 26 de Mzo. de 2023
I want to produce a figure with 3 stacked plots where the bottom one is split in half vertically, how might I do this? TIA
3 comentarios
Dyuman Joshi
el 26 de Mzo. de 2023
Just a note - The output you want is horizontally stacked, not vertically.
Respuesta aceptada
Star Strider
el 26 de Mzo. de 2023
Perhaps this —
clearvars
x = -10:0.01:10;
y = cos(x);
figure(1)
subplot(2,2,[1 2])
plot(x, y)
subplot(2,2,3)
plot(x, y)
subplot(2,2,4)
plot(x, y)
I defer to you to decide what should be plotted in which subplot axes.
.
2 comentarios
Star Strider
el 26 de Mzo. de 2023
Ir makes sense. I wasn’t certain what the desired result was, exactly. I thought you only wanted three plots, one large on on top and the lower one split.
Perhaps this —
clearvars
x = -10:0.01:10;
y = cos(x);
figure(1)
subplot(3,2,[1 2])
plot(x, y)
subplot(3,2,[3 4])
plot(x, y)
subplot(3,2,5)
plot(x, y)
subplot(3,2,6)
plot(x, y)
.
Más respuestas (2)
Matt J
el 26 de Mzo. de 2023
Editada: Matt J
el 26 de Mzo. de 2023
Is this what you mean?
close all
x = -10:0.01:10;
y = cos(x);
ax=subplot(2,2,[1,2]); axis square
plot(x,y)
ax.Position=shrink(ax.Position);
subplot(2,2,3); plot(x,y); axis square
subplot(2,2,4); plot(x,y); axis square
function pos=shrink(pos)
o=pos(1:2);
d=pos(3:4);
pos=[o(1)+d(1)/3,o(2),d(1)/3,d(2)];
end
0 comentarios
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!