matplotlib图例显示双错误栏

时间:2012-04-25 00:54:09

标签: python matplotlib

为什么matplotlib显示两个错误栏?我认为它可能与非对称误差条有关。

enter image description here

你可以用这个重现问题:

>>> import matplotlib.pyplot as plt
>>> plt.errorbar([1,2,3],[3,4,2],yerr=[[1,2,0.5]]*2, label='data')
<Container object of 3 artists>
>>> plt.legend()
<matplotlib.legend.Legend object at 0x10b82f590>
>>> plt.show()

1 个答案:

答案 0 :(得分:13)

您可以设置图例中的点数:

plt.legend(numpoints=1)