Stacking plots using subplot

17 ビュー (過去 30 日間)
C Ryan
C Ryan 2017 年 8 月 16 日
編集済み: Matt J 2018 年 7 月 15 日
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

採用された回答

KL
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 件のコメント
C Ryan
C Ryan 2017 年 8 月 16 日
Thank you KL
Jan
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 ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by