필터 지우기
필터 지우기

Plot values of a boxplot next to it?

조회 수: 2 (최근 30일)
Lorenz
Lorenz 2022년 7월 14일
댓글: Lorenz 2022년 7월 14일
Hi,
i'm currently working with the matlab function boxplot and need a representation of the corresponding values next to the boxplots (see figure) for better clarity. Is there any possibility to implement this with boxplot? In my use case the number of boxplots changes depending on the user input, so a static positioning of the numbers is not possible.
Thanks in advance!

채택된 답변

Chunru
Chunru 2022년 7월 14일
x1 = rand(5,1);
x2 = rand(10,1);
x3 = rand(15,1);
x = [x1; x2; x3];
g1 = repmat({'First'},5,1);
g2 = repmat({'Second'},10,1);
g3 = repmat({'Third'},15,1);
g = [g1; g2; g3];
boxplot(x,g)
qx1 = quantile(x1, [.25 .5 .75]);
qx2 = quantile(x2, [.25 .5 .75]);
qx3 = quantile(x3, [.25 .5 .75]);
hold on
text(1+.25+zeros(1,3), qx1, string(qx1), 'HorizontalAlignment', 'left');
text(2+.25+zeros(1,3), qx2, string(qx2), 'HorizontalAlignment', 'left');
text(3+.25+zeros(1,3), qx3, string(qx3), 'HorizontalAlignment', 'left');

추가 답변 (0개)

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by