0

How can I plot an errorbar plot in python, having for y different errors up and down? I have x,y, and the values for each error in different lists. I tried this but it doesn't work:

plt.errorbar(x,y,[std_y_down,std_y_up],"r^")

1 Answer 1

1

The error you probably got is reasonably informative:

ValueError: yerr must be a scalar, the same dimensions as y, or 2xN.

In other words, if you want different plus and minus errors you need a pair of sequences, each of the same length as your data e.g.:

plt.errorbar(x,y,yerr=[[0.5]*len(x),[1.5]*len(x)],fmt='r^')

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.