フィルターのクリア

confidence interval on bar plot

85 ビュー (過去 30 日間)
HL
HL 2021 年 10 月 12 日
コメント済み: HL 2021 年 10 月 12 日
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.

採用された回答

Antti
Antti 2021 年 10 月 12 日
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 件のコメント
HL
HL 2021 年 10 月 12 日
Thank you so much!!! It worked perfectly as I wanted.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeErrorbars についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by