我有4個不同的數字。每個圖包含2個子圖(2行1列)合併4個子圖4個子圖
可以使用以下代碼生成數字。
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
for i = 1 : 4
figure(i)
subplot(2,1,1)
bar(y)
subplot(2,1,2)
bar(y)
end
有了這4位數字,是否有可能他們1個圖結合?
提供的解決方案不適用於其他示例,其中我使用barwitherr創建圖形,爲什麼?
for i = 1 : 4
figure(i)
subplot(2,1,1)
barwitherr([1 2 3 4;1 2 1 2], [5 6 7 8;1 2 3 4])
subplot(2,1,2)
barwitherr([1 2 3 4;1 2 1 2], [5 6 7 8;1 2 3 4])
end
for i = 1:4
figure(i);
ax = gca;
f = get(ax, 'children');
figure(5);
s = subplot(2, 2, i);
copyobj(f, s);
end
在創建或之後合併? – thewaywewalk
我很困惑,這裏有8個子圖。 – excaza
後合併 – gabboshow