Matplotlib is a plotting library written in Python that can be used to create all sorts of plots. If markers are being used in the plot, then two markers at the end points of a line are shown in the legend.
You may want to customize the number of markers shown in the legend. For example, I like to have one marker shown in the middle of the line segments displayed in the legend.
To customize the number of markers shown in the legend assign that value to the named argument numpoints in the call to pyplot.legend():
matplotlib.pyplot.legend( ..., numpoints=1 )
Tried with: Matplotlib 1.2, Python 3.2.3 and Windows 7 x64