Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib legend showing double errorbars

Why is matplotlib is showing two error bars? I think it may have something to do with the asymmetric error bars.

enter image description here

You can reproduce the problem with this:

>>> 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()
like image 483
user545424 Avatar asked Apr 25 '12 00:04

user545424


1 Answers

you can set the number of points in legend:

plt.legend(numpoints=1)
like image 102
HYRY Avatar answered Oct 11 '22 17:10

HYRY