3 subplots with the bottom one split in 2 vertically?

조회 수: 14 (최근 30일)
HC98
HC98 2023년 3월 26일
댓글: Star Strider 2023년 3월 26일
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
HC98
HC98 2023년 3월 26일
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 2023년 3월 26일
Just a note - The output you want is horizontally stacked, not vertically.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2023년 3월 26일
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
HC98
HC98 2023년 3월 26일
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 2023년 3월 26일
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)
.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Bruno Luong
Bruno Luong 2023년 3월 26일
Plenty of examples are given in the doc page

Matt J
Matt J 2023년 3월 26일
편집: Matt J 2023년 3월 26일
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

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by