Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 python 中绘制误差线图,上下有 y 个不同的错误?我有 x、y 以及不同列表中每个错误的值。我试过这个但它不起作用:
plt.errorbar(x,y,[std_y_down,std_y_up],"r^")
您可能得到的错误信息相当丰富:
ValueError: yerr must be a scalar, the same dimensions as y, or 2xN.
换句话说,如果您想要不同的正负误差,则需要一对序列,每个序列的长度与您的数据相同,例如:
plt.errorbar(x,y,yerr=[[0.5]*len(x),[1.5]*len(x)],fmt='r^')