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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to