From: Steven B. <bo...@ph...> - 2012-06-13 20:32:19
|
The gca().collections.set_label('label') works great. Admittedly, I'm not sure why it works. I'm not that great with the collections stuff. But thanks! S On 06/13/2012 03:22 PM, Mike Kaufman wrote: > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Steven Boada Dept. Physics and Astronomy Texas A&M University bo...@ph... |