Effacer les filtres
Effacer les filtres

confidence interval on bar plot

86 vues (au cours des 30 derniers jours)
HL
HL le 12 Oct 2021
Commenté : HL le 12 Oct 2021
I already have the mean calculated and the bar graph is acttually my 4 mean values. All I want to do is to show that I have 95% confidence interval for these values and indicate on the plot which of the groups are significantly different from one another.
For all other confidence interval tutorial I have looked at, they teach me from how to calculate the mean and obtain a confidence interval. However, I do not need to know these. I just wnat to know how to get that confidence interval bar on my bar plot.

Réponse acceptée

Antti
Antti le 12 Oct 2021
Hi! I believe you could use the errorbar function. Here's an example:
% Create groups and data
X = categorical({'Small','Medium','Large','Extra Large'});
X = reordercats(X,{'Small','Medium','Large','Extra Large'});
Y = [10 21 33 52];
% Make a bar plot
bar(X,Y)
% Plot on top of bar plot
hold on
% errorbar(x,y,ci,marker) where ci is the height of the line. This can be
% computed from your confidence intervals.
errorbar([1 2 3 4],[10 21 33 52],[4 6 7 8],'o')
If this works for you, please formally accept this answer.
  1 commentaire
HL
HL le 12 Oct 2021
Thank you so much!!! It worked perfectly as I wanted.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Errorbars dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by