The matplotlib legend shows a double error

Why does matplotlib show two error lines? I think this may have something to do with asymmetric errors.

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() 
+6
source share
1 answer

You can set the number of points in the legend:

 plt.legend(numpoints=1) 
+13
source

Source: https://habr.com/ru/post/914083/


All Articles