# Should the standard deviation vary along the curve?

I need to draw the error bars on a curve. in the images I have seen that this process is done, the bar lengths change from point to point.

but when I do for my curve I get something like :

I am doing the calcualtions by Python. and use this code

what Python asks me to calculate standard deviation is a list that contain all of the values of one of the axes on a 2D curve I have :

STDV_Mag=np.std(Mag)


then if I use this value :

line_Mag=ax.errorbar(xerr, Magerr, yerr=STDV_Mag, **lineStyle_Mag, color=color_Mag, label=filename + ShN[0])


I will have a plot with error bars all the same. Where am I going wrong ?

Edit 2 : to provide some data to explain what I need :

let's imagine the horizontal axis has these points :

t= [10 , 20 , 30 ,40 , 50 , 60 ,70 +

and I have 4 curves that their vertical axis values at the points above are :

c1= [18 , 15 , 14 , 10 , 11 , 12 , 25]

c2= [19.5 , 16.9 , 15.5 , 11.2 , 12.5 , 13.8 , 11]

c3= [19 , 17.1 , 16.1 , 12.3 , 13.6 , 11 , 27.5]

c4= [22 , 18.9 , 17.7 , 13.9 , 11.7 , 12 , 22]

so to draw the graph in blue above , I should first find a curve c5 that its values are the point to point average of all of the 4 curves. then calculate the standard deviation (sd) of the whole curve which is one number.

the other way is that after finding the curve c5, I calculate the sd of each group of 4 points and report them on the curve, so I will have something like curve in red.

What I need to know is the conceptual difference and statistical correctness of these , and their meaning.

• @mkt Is that clear now ? – FabioSpaghetti Sep 18 '19 at 12:23
• @whuber is the question clear now ? – FabioSpaghetti Sep 18 '19 at 12:23
• Thank you for the graphics. Although the overall nature of the question is evident, you haven't described any data or procedures to produce those error bars. That information is crucial for understanding what you're trying to ask. – whuber Sep 18 '19 at 13:40
• @whuber sure, I added second edit with data – FabioSpaghetti Sep 18 '19 at 15:25
• For each abscissa value, e.g., t = 10, you have 4 integer values, e.g., 18, 19, 20 & 21. Always 4 consecutive integers! All that changes is the mean of the 4 integers! So the standard deviation is the same for each t value (and equals 1.291) and the error bars are constant length. – Ed V Sep 18 '19 at 15:56