matlab subplot
조회 수: 3 (최근 30일)
이전 댓글 표시
Hallo,
how can I plot different figures in the same figure window? I use a for loop to plot because I am working with cell arrays: example:
for i_z = 26:34
figure
hold on
a = horzcat (dummy_A{i_z}(:,2), dummy_A{i_z}(:,5));
b = horzcat (dummy_B{i_z}(:,2), dummy_B{i_z}(:,5));
plot (a(:,1), a(:,2), 'ob', 'MarkerSize', 7, 'Linewidth', 2)
plot (b(:,1), b(:,2), 'xg', 'MarkerSize', 7, 'Linewidth', 2)
end
This plots a series of windows (9) and for a window i get the plots of a and b for i_z equal to one value.
I'd like to have those 9 windows in one plot window 3x3 as subplots.
Thanks.
Sami
댓글 수: 0
채택된 답변
Oleg Komarov
2011년 8월 6일
Call figure before the loop, then inside before hold on:
subplot(3,3,i_z-25)
% Example
figure
for n = 1:9
subplot(3,3,n)
hold on
plot(1:10,1:10,'r')
plot(1:10,10:-1:1,'b')
end
댓글 수: 0
추가 답변 (1개)
Dustin
2011년 8월 6일
Hi Sami,
Refer to the MATLAB documentation on the function subplot:
By selecting the appropriate subplot as:
subplot(3,3,i_z-25)
before the plot commands, you should get what you need.
Cheers, Dustin.
댓글 수: 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!