Hi all,
By default, 'legend' uses two points two represent a line. This looks
a bit weird when you have only markers (no line), e.g.,
import matplotlib.pyplot as plt
plt.plot([1,2,3], [4,5,6], 'x', label='first line')
plt.legend()
plt.show()
Notice how there are two crosses in the legend. Having only one, as in
import matplotlib.pyplot as plt
plt.plot([1,2,3], [4,5,6], 'x', label='first line')
plt.legend(numpoints=1)
plt.show()
would look better.
Unfortunately, I can't always use numpoints=1, because then the legend
for a normal line isn't drawn properly:
import matplotlib.pyplot as plt
plt.plot([1,2,3], [4,5,6], 'x-', label='first line')
plt.legend(numpoints=1)
plt.show()
What would be ideal (for me personally), is to have, for numpoints=1:
linestyle 'x' ---> legend ' x '
linestyle '-x' ---> legend '---x---'
Has this been considered before? If not, I'll write a patch.
Regards
Stéfan