MATLAB Answers

0

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

Asked by Noah Wilson on 18 Jul 2018
Latest activity Commented on by Stephane on 19 Jul 2018
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 Comments

Please see the errorbar function ( web ).
That doesn't allow me to have different error bars for each value tho. Unless I am missing something
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.

Sign in to comment.

Tags

0 Answers