Plotting multiple boxplots within the same plot/figure
조회 수: 23 (최근 30일)
이전 댓글 표시
I have six variables that I would like to plot within the same figure/plot as individual box-plots. I have tried doing so by plotting one, then using 'hold on' before the plotting the next, but this hasn't worked. How might I go about doing this?
Thank you.
댓글 수: 2
채택된 답변
Walter Roberson
2012년 12월 1일
subplot(3,1,1)
boxplot(mat1, 'notch', 'on', 'colors', 'r')
subplot(3,1,2)
boxplot(mat2, 'notch', 'on', 'colors', 'b')
subplot(3,1,3)
boxplot(mat3, 'notch', 'on', 'colors', 'c')
추가 답변 (1개)
Emma
2012년 12월 1일
댓글 수: 1
Walter Roberson
2012년 12월 1일
shortcut:
NMat = nan(6, 10000);
And since you are copying the same number of columns for each you can eliminate the other lines:
boxplot( [mat1(:), mat2(:), mat3(:), mat4(:), mat5(:), mat6(:)], 'notch', 'on', 'color', 'rb')
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!