python - Use MatPlotLib to plot line graph with error ranges around points -


i'm trying plot line graph of ten values error ranges on each point:

u = [1,2,3,4,5,6,7,8,9,10] plt.errorbar(range(10), u, yerr=1) plt.show() 

i error message

valueerror: many values unpack 

can please advise me best way plot line graph error bars on each point? http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.errorbar

thx

plt.errorbar expects errors have same dimension x- , y-values (either list of 2-tuples up/down errors or simple list symmetric errors).

you want like

u = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] plt.errorbar(range(10), u, yerr=[1]*10) 

or more numpy imported np

u = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] plt.errorbar(np.arange(10), u, yerr=np.ones(10)) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -