필터 지우기
필터 지우기

Adding sigstar to grouped bar graph

조회 수: 15 (최근 30일)
Hanna Armstrong
Hanna Armstrong 2024년 7월 26일 0:01
댓글: Star Strider 2024년 7월 26일 1:05
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!

답변 (1개)

Star Strider
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
Hanna Armstrong
Hanna Armstrong 2024년 7월 26일 0:43
편집: Hanna Armstrong 2024년 7월 26일 0:44
Hi, thank you for responding.
I would like to add a sgnificane bar between the bargraphs that are grouped. I already have the errorbar. like what I have for participant 1 in this example
Star Strider
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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by