필터 지우기
필터 지우기

How to creat two box plot in one graph use different data?

조회 수: 1 (최근 30일)
Weiyan Chen
Weiyan Chen 2016년 10월 2일
댓글: Weiyan Chen 2016년 10월 2일
a=[9 3 5 3 0 10 6 8 4 9 7 3 8 6 6 9 1 8 8 6 10]
b=[10 7 5 6 8 6 4 7 8 8 9 7 10 7 6 6 7 2 8 10 8]
this is the two group number.

채택된 답변

the cyclist
the cyclist 2016년 10월 2일
One way is to use a "grouping variable" as the second argument:
a=[9 3 5 3 0 10 6 8 4 9 7 3 8 6 6 9 1 8 8 6 10];
b=[10 7 5 6 8 6 4 7 8 8 9 7 10 7 6 6 7 2 8 10 8];
ag = ones(size(a));
bg = 2*ones(size(b));
figure
boxplot([a b]',[ag bg]')
set(gca,'XTickLabel',{'a','b'})

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 10월 2일
a=[9 3 5 3 0 10 6 8 4 9 7 3 8 6 6 9 1 8 8 6 10];
b=[10 7 5 6 8 6 4 7 8 8 9 7 10 7 6 6 7 2 8 10 8];
boxplot( [a(:), b(:)], [1 * ones(length(a),1); 2 * ones(length(b),1)])

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by