plot figures using a for loop and subplot function
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a dataset of around 180 columns of data to be plotted with respect to another constant dataset. My initial try was to plot the datasets using a for loop for different combinations of the data using a looping command and subplot function. I have succeeded in plotting for around 15-20 but then i noticed that the loop command cannot be fixed at the next index for the next set of plots.
for i = 1:15
subplot (5,3,i)
plot (outdoor_temp,D(:,i), "r *")
xlabel ('Outdoor tempe(C)')
ylabel ('Energy load')
title (var{i})
end
for i = 16:30
subplot (5,3,i)
plot (outdoor_temp,D(:,i), "r *")
xlabel ('Outdoor tempe(C)')
ylabel ('Energy load')
title (var{i})
end
댓글 수: 0
답변 (1개)
KSSV
2022년 2월 14일
편집: KSSV
2022년 2월 14일
If you want in two different figure:
figure(1)
for i = 1:15
subplot (5,3,i)
plot (outdoor_temp,D(:,i), "r *")
xlabel ('Outdoor tempe(C)')
ylabel ('Energy load')
title (var{i})
end
figure(2)
for i = 16:30
subplot (5,3,i-15) % <---- subtract 15 here
plot (outdoor_temp,D(:,i), "r *")
xlabel ('Outdoor tempe(C)')
ylabel ('Energy load')
title (var{i})
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!