How to make a box plot with a scatter plot overlay with uneven data sets
조회 수: 30 (최근 30일)
이전 댓글 표시
As the title states, I would like to make a box plot using two different mean from uneven data sets. I would also like to overlay the bars with a scatter plot of the individual data. Can someone please help me?
댓글 수: 0
답변 (1개)
Angelo Yeo
2023년 7월 20일
I'm not sure what you want. However, consider using hold on in order to overlay multiple plots on an axis.
x1 = ones(1,100);
x2 = 2 * ones(1,100);
x3 = 3 * ones(1,100);
y1 = 2 * randn(1,100);
y2 = [randn(1,50) randn(1,50) + 4];
y3 = 5 * randn(1,100) + 5;
%% plotting
h = boxplot([y1, y2, y3], [x1, x2, x3]);
set(h, {'linew'},{2})
hold on
swarmchart(x1,y1,5)
swarmchart(x2,y2,5)
swarmchart(x3,y3,5)
hold off
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
