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

조회 수: 6 (최근 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 CenterFile Exchange에서 Errorbars에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by