Stacking plots using subplot

11 Ansichten (letzte 30 Tage)
C Ryan
C Ryan am 16 Aug. 2017
Bearbeitet: Matt J am 15 Jul. 2018
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

Akzeptierte Antwort

KL
KL am 16 Aug. 2017
Bearbeitet: KL am 16 Aug. 2017
figure
subplot(3,1,1) %subplot(rows,coloumns,current_axis)
subplot(3,1,2)
subplot(3,1,3)
  2 Kommentare
C Ryan
C Ryan am 16 Aug. 2017
Thank you KL
Jan
Jan am 15 Jul. 2018
@Hamilton Tesheira: Please use flags only to inform admins and editors about inappropriate content like spam or rudeness. Thanks.
Hamilton Tesheira wrote:
ditto

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by