errorbar command shows value error in xerr value
Title
Question
S=[0.19, 0.38, 0.57, 0.77, 0.96, 1.15, 1.34, 1.54, 1.73]
n=[10.74, 14.01, 18.52, 20.23, 22.88, 24.59, 27.55, 28.48, 30.20]
delta_S=[0.006, 0.006, 0.005, 0.003, 0.003, 0.004, 0.007, 0.004, 0
...: .004, 0.007]
delta_n=[0.61, 0.69, 0.53, 0.38, 0.46, 0.37, 0.46, 0.46, 0.37]
In [24]: plot(S,n,'.')
Out[24]: [<matplotlib.lines.Line2D at 0x18ab592b890>]
In [25]: clf()
In [26]: plot(S,n,'.')
Out[26]: [<matplotlib.lines.Line2D at 0x18ab1760b00>]
In [27]: errorbar(S,n, xerr=delta_S, yerr=delta_n, fmt='.')
ValueError Traceback (most recent call last)
Cell In[27], line 1
----> 1 errorbar(S,n, xerr=delta_S, yerr=delta_n, fmt='.')
ValueError: 'xerr' (shape: (10,)) must be a scalar or a 1D or (2, n) array-like whose shape matches 'x' (shape: (9,))
The previous exercise has no problem with this command but in this the value of delta_S is having three decimal places. Maybe that is causing the error, but not sure. please help with this.
Python-3.4.3 Plotting-Data 05-06 min 0-10 sec
Answers:
Please cross check the value of delta S as given in the tutorial
Login to add comment