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

1 次查看(过去 30 天)
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 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by