matplotlib plot with error bars code example
Example 1: error bar plot python
x = [0,1,2,3,4,5]
y = [3,2,4,5,1,5]
yerr=[0.3,0.2,0.4,0.5,0.1,0.5]
fig, ax = plt.subplots(figsize=(8,8))
ax.errorbar(x, y, yerr=yerr, fmt='-o', color='k')
ax.set_title('My title')
ax.set_ylabel('My ylabel')
ax.set_xlabel('My xlabel')
plt.show()
Example 2: matplotlib error bars
#Plot symmetric error bar in both dimension
#if only one dimension needed, omit xerr or yerr
plt.errorbar(x, y, xerr=xerr, yerr=yerr)