Trouble adding error bars to bar graph

2 ビュー (過去 30 日間)
Heidi Hirsh
Heidi Hirsh 2020 年 3 月 17 日
コメント済み: Heidi Hirsh 2020 年 3 月 24 日
I am trying to add error bars to bar graph. The figure looks fine if I run it without the error bars as just bar(coh). (see attached) I want to the bars to be groups as shown. I'm wondering if that grouping is messing up the error bars.
Thank you in advance for any help!
Hope you are all staying safe and healthy Matlab community.
x = 1:12;
coh = [0.9862, 0.9773
0.971, 0.9544
0.8969, 0.6791
0.8835, 0.9051
0.8558, 0.6727
0.6727, 0.8641];
errhigh = [0.0083, 0.0137
0.0137, 0.0274
0.0611, 0.1797
0.0688, 0.0563
0.1426, 0.1829
0.0875, 0.0799];
errlow = [0.0208, 0.034
0.043, 0.0661
0.1382, 0.3105
0.1533, 0.1288
0.1827, 0.3135
0.1879, 0.1743];
figure
bar(x,coh)
%bar(coh)
hold on
er = errorbar(x,coh,errlow,errhigh);
er.Color = [0 0 0];
er.LineStyle = 'none';
hold off
  3 件のコメント
dpb
dpb 2020 年 3 月 17 日
In 40 years, TMW has yet to provide any decent hatching... :(
There are some submissions on File Exchange; all that I've used have warts of various severity; and whether any will work with bar I've never tried/looked.
Heidi Hirsh
Heidi Hirsh 2020 年 3 月 17 日
Dang! I might hold off on that detail for now. The error bar issue is more critical at the moment. Thank you for the heads up!

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

採用された回答

dpb
dpb 2020 年 3 月 17 日
  9 件のコメント
dpb
dpb 2020 年 3 月 24 日
Rearrange your groups/x values to match the groups you want highlighted the same.
Heidi Hirsh
Heidi Hirsh 2020 年 3 月 24 日
I'm not sure I understand what you mean

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by