Stacking plots using subplot
조회 수: 11 (최근 30일)
이전 댓글 표시
Hi, I'm trying to stack 3 plots vertically using subplot. So far I have only been able to figure out how to place 2 side by side with one above/below. Any help would be greatly appreciated - I'm new to MATLAB
The code and ouput image are attached below. Ideally, I would like the three graphs to be the same size and stacked vertically.
clc;
clear all;
close all;
f = figure;
p = uipanel('Parent',f,'BorderType','none');
[num,txt,raw]=xlsread('manual2017.xlsx','SE vs Master');
data=num(:,8);
subplot(2,2,[1,2],'Parent',p);
h = cdfplot(data);
h.LineWidth = h.LineWidth + 1;
xlabel('Errors per sheet %','fontsize', 12)
ylabel('Proportion of values less than or equal to x','fontsize', 12)
title('(a) CDF - Evaluation of student errors n=2556', 'fontsize', 12)
subplot(2,2,3, 'Parent', p);
data2=num(1:6,19);
bar(data2)
name = {'< 5';'5 - 10';'11 - 20';'21 - 40';'> 40';'Total'};
set(gca,'xticklabel',name)
xlabel('Error Category','fontsize', 12)
ylabel('Number of incorrect sheets','fontsize', 12)
title('(b) Evaluation of student errors n=2556', 'fontsize', 12)
subplot(2,2,4,'Parent',p);
data3=xlsread('plot_me_vs_students.xlsx');
me_err=data3(:,1);
stu_err=data3(:,2);
hb=bar(data3(:,1:2));
set(hb(2),'facecolor','c')
name = {'< 5';'5 - 10';'11 - 20';'21 - 40';'> 40';'Total'};
set(gca,'xticklabel',name)
xlabel('Error Category', 'fontsize', 12)
ylabel('Number of incorrect sheets','fontsize', 12)
title('(c) Evaluation of student vs. ME errors n=274', 'fontsize', 12)
labels = {'ME','Students'};
legend(labels,'Location','north','Orientation','horizontal')
set(gcf,'Paperunits','centimeters','Paperposition',[0 0 30 30]);
print -dtiff -cmyk -r600 ciara_cdf_student_errors.tif
댓글 수: 0
채택된 답변
KL
2017년 8월 16일
편집: KL
2017년 8월 16일
figure
subplot(3,1,1) %subplot(rows,coloumns,current_axis)
subplot(3,1,2)
subplot(3,1,3)
댓글 수: 2
Jan
2018년 7월 15일
@Hamilton Tesheira: Please use flags only to inform admins and editors about inappropriate content like spam or rudeness. Thanks.
Hamilton Tesheira wrote:
ditto
추가 답변 (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!