On 6/13/12 4:06 PM, Steven Boada wrote:
>
> Well I am doing a lot more than this simple example shows. Point is that
> there are nine different points each with their own legend entry.
>
> I could put it all out of the for loops, but it is all already written,
> and I'd rather just fix the legend at the end than move sections of the
> code around. I'm willing to do it, if that is the only choice, but I
> wanted to ask before I commit my time.
>
> Wouldn't it be a good (smart) thing for the code to lump all the points
> with the same label together? This would be a great feature to be added IMO.

Assuming that you already have ten scatter plots, change the labels on 
the ones you don't want in the legend to '_nolegend_' (see help(legend))

for i in range(10):
   gca().collections[i].set_label('_nolegend_')
gca().collections[0].set_label('the one label I want')
legend()
draw()

M

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to