Matplotlib图例显示双误差棒

6

为什么matplotlib展示了两个误差条?我认为这可能与不对称的误差条有关。

在此输入图片描述

您可以使用以下内容复现此问题:

>>> 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()

Python和Matplotlib的哪个版本?我无法使用Python2.7和Matplotlib 1.1.0重现它。 - Zenon
Python 2.7.2 和 matplotlib 1.1.0 - user545424
1个回答

13

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

plt.legend(numpoints=1)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接