3 subplots with the bottom one split in 2 vertically?

14 views (last 30 days)
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 Comments
HC98
HC98 on 26 Mar 2023
So Something like this
clearvars
x = -10:0.01:10
x = 1×2001
-10.0000 -9.9900 -9.9800 -9.9700 -9.9600 -9.9500 -9.9400 -9.9300 -9.9200 -9.9100 -9.9000 -9.8900 -9.8800 -9.8700 -9.8600 -9.8500 -9.8400 -9.8300 -9.8200 -9.8100 -9.8000 -9.7900 -9.7800 -9.7700 -9.7600 -9.7500 -9.7400 -9.7300 -9.7200 -9.7100
y = cos(x)
y = 1×2001
-0.8391 -0.8445 -0.8498 -0.8550 -0.8602 -0.8652 -0.8702 -0.8751 -0.8799 -0.8846 -0.8892 -0.8937 -0.8982 -0.9025 -0.9068 -0.9109 -0.9150 -0.9190 -0.9229 -0.9267 -0.9304 -0.9340 -0.9376 -0.9410 -0.9443 -0.9476 -0.9507 -0.9538 -0.9567 -0.9596
% figure(1)
subplot(3,1,1)
plot(x, y)
subplot(3,1,2)
plot(x, y)
subplot(3,1,3)
plot(x, y)
Except the bottom two pannels are split into 2 seperate plots, vertically like 2 blocks side by side
Dyuman Joshi
Dyuman Joshi on 26 Mar 2023
Just a note - The output you want is horizontally stacked, not vertically.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 26 Mar 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 Comments
HC98
HC98 on 26 Mar 2023
Hmm close but I wanted another big plot in the middle so it's 2 large ones and the bottom pane split in 2 if that makes sense?
Star Strider
Star Strider on 26 Mar 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)
.

Sign in to comment.

More Answers (2)

Bruno Luong
Bruno Luong on 26 Mar 2023
Plenty of examples are given in the doc page

Matt J
Matt J on 26 Mar 2023
Edited: Matt J on 26 Mar 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

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!