Adding sigstar to grouped bar graph
조회 수: 15 (최근 30일)
이전 댓글 표시
Hello,
I have sets of data that is being compared within each group. However, I need to display all of the groups on one graph so I can show how differences compare across various participants. Right now, this is the graph that I have. I would like to add sigmas between various blue, red, yellow bars depending of the results of the individual participant. Does anyone know how I could possible do that?
Thank you for your time!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1741041/image.png)
댓글 수: 0
답변 (1개)
Star Strider
2024년 7월 26일 0:32
I am not certtain what you are asking, and you did not post your MATLAB release. (Itt would help to have your datta, the code you already wrote to process it, and what you want it ttto do.)
If you want to add error bars to the bars, that is straightforward —
Data = randi(9, 4, 3);
err = rand(size(Data));
figure
hb = bar(Data);
hold on
for k = 1:size(Data,2)
xc = hb(k).XEndPoints;
yc = hb(k).YEndPoints;
errorbar(xc, yc, err(:,k), '.k', 'MarkerSize',0.1)
end
hold off
.
댓글 수: 2
Star Strider
2024년 7월 26일 1:05
My pleasure!
O.K. That is a variation of the error bar approach.
Try this —
Data = randi(9, 4, 3);
err = rand(size(Data));
figure
hb = bar(Data);
hold on
for k = 1:size(Data,2)
xc = hb(k).XEndPoints;
yc = hb(k).YEndPoints;
errorbar(xc, yc, err(:,k), '.k', 'MarkerSize',0.1)
end
bw = hb(1).BarWidth;
xc(1,:) = hb(1).XEndPoints;
xc(2,:) = hb(end).XEndPoints;
yc(1,:) = hb(1).YEndPoints;
yc(2,:) = hb(end).YEndPoints;
xcr = xc(:,1) + [-bw; bw]/4;
ycr = max(yc(:,1));
plot(xcr, [1 1]*ycr*1.5, '-k', 'LineWidth',3)
plot(mean(xcr), ycr*1.6, '*k', 'MarkerSize',15)
hold off
Make appropriatte changes to get the result you want.
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!