How do I add std bars to the Graph I just created?
1 view (last 30 days)
Show older comments
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
Stephane
on 19 Jul 2018
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.
Answers (0)
See Also
Categories
Find more on Errorbars in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!