![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175199/image.jpeg)
Change sublot size and position
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all,
I tried, but failed to change the position and size of various subplots (see picture); here's the code:
figure
subplot(n+1,1,1),plot(P_est)
cl={'r','y','g'};
for m=2:n+1;
subplot(n+1,1,m);
for q=1:t;
xx=[q-1,q] ;
plot([ xx fliplr(xx) xx(1)],[0 0 1 1 0],cl{M{1,m-1}(q)+1},'linewidth',12)
hold on
end
hold off
end
How do I get to the desired configuration so the first graph is the biggest and all other bars are smaller?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165223/image.jpeg)
Thanks!
0 件のコメント
採用された回答
Ben11
2014 年 7 月 3 日
編集済み: Ben11
2014 年 7 月 3 日
You can play with the subplot command to make the first graph span multiple subplot spots. Here is a simple example where the sin(x) curve occupies the first 2 subplots:
clear all
clc
x = 1:10;
figure
subplot(4,1,1:2) % That's where you tell the plot to occupy the spots from 1 to 2 or whatever you want.
plot(sin(x));
title('Sin x');
subplot(4,1,3),
plot(cos(x));
title('Cos x');
subplot(4,1,4);
plot(tan(x));
title('Tan x');
which outputs this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175199/image.jpeg)
So I guess you could add an if statement in you for-loop which does the same for your first graph.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!