Stacking plots using subplot
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!