Plotting Multiple Box Plots in Same Graph

I intend to plot multiple Box Plots in the same Graph. How to do that? If i use 'hold on', it jumbles all of them over one another.
boxplot(satisfaction_1,'notch', 'on');
hold on;
boxplot(satisfaction_2,'notch', 'on');
hold on;
boxplot(satisfaction_3,'notch', 'on');
hold on;
boxplot(satisfaction_4,'notch', 'on');
hold on;

답변 (1개)

KL
KL 2017년 5월 24일
편집: KL 2017년 5월 24일

0 개 추천

boxplot([satisfaction_1 satisfaction_2 satisfaction_3 satisfaction_4]...
,'Notch', 'on','Labels',{'S1','S2','S3','S4'}); %edited

댓글 수: 5

A M
A M 2017년 5월 24일
Hi, thank you. It's still not working. Do i have to put commans in between satisfaction_1 and satisfaction_2 ..., and what does S1...S4 signifies here?
KL
KL 2017년 5월 24일
Oh sorry, those were labels. I edited the command now. what is your error message?
A M
A M 2017년 5월 24일
Well, there appears to be some issue with labels. Secondly, even if i remove Labels, S1...S4, it still combines all four box plots into one box plot. I actually want to see them all together side by side in order to demonstrate comparison
I'm not entirely sure what you mean but sounds like a subplot to me.
figure
subplot(1,3,1)
boxplot(x1)
subplot(1,3,2)
boxplot(x2)
subplot(1,3,3)
boxplot(x3)
A M
A M 2017년 5월 24일
@KL ... subplot would make windows in the same graph. While i want to place all sub box plots in the same graph

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

A M
2017년 5월 24일

댓글:

A M
2017년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by