Effacer les filtres
Effacer les filtres

Adding sigstar to grouped bar graph

15 vues (au cours des 30 derniers jours)
Hanna Armstrong
Hanna Armstrong le 26 Juil 2024 à 0:01
Commenté : Star Strider le 26 Juil 2024 à 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!

Réponses (1)

Star Strider
Star Strider le 26 Juil 2024 à 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 commentaires
Hanna Armstrong
Hanna Armstrong le 26 Juil 2024 à 0:43
Modifié(e) : Hanna Armstrong le 26 Juil 2024 à 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 le 26 Juil 2024 à 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.
.

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by