How do I add std bars to the Graph I just created?

1 回表示 (過去 30 日間)
Noah Wilson
Noah Wilson 2018 年 7 月 18 日
コメント済み: Stephane 2018 年 7 月 19 日
So I would like to add std bars to each individual value on this graph I made and am unsure how to do it. Here is the code I used to produce the graph. The Standard Deviation is different for each value as well. I apologize if the code is poor or if it is confusing. The chc and cnhc does have meaning to me but probably not to anyone else so I apologize if that is confusing.
chc6 = [3875.1 3875.1 3874.9 0 0 0 0 0 0 0 0];
chc8 = [0 0 0 3875.4 3874.9 3871.5 3871.7 3874.5 3874.9 3876.9 3879.6];
nchc2 = [3882.8 0 0 0 0 0 0 0 0 0 0];
nchc4 = [0 3891.2 3886.5 0 0 0 0 0 0 0 0];
nchc8 = [0 0 0 3895.5 0 0 0 0 0 0 0];
nchc10 = [0 0 0 0 3900.6 3900.4 0 0 0 0 0];
figure(1), plot(chc6, 'ko')
figure(1), hold on, plot(chc8, 'go')
figure(1), hold on, plot(nchc2, 'rd')
figure(1), hold on, plot(nchc4, 'bd')
figure(1), hold on, plot(nchc8, 'gd')
figure(1), hold on, plot(nchc10, 'md')
  3 件のコメント
Noah Wilson
Noah Wilson 2018 年 7 月 18 日
That doesn't allow me to have different error bars for each value tho. Unless I am missing something
Stephane
Stephane 2018 年 7 月 19 日
Errorbar is super flexible (see the examples " Control Error Bars Lengths in All Directions" or " Plot Vertical Error Bars that Vary in Length") in the doc. Overlapping points or bars can be solved by adding a small value to x.

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

回答 (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