On Aug 31, 2012, at 11:29AM, Goyo wrote: > 2012/8/30 Sterling Smith <smit...@fusion.gat.com>: > >> Thank you for taking the time to consider my question. I'm sorry that I >> didn't pose my question correctly. I should have said: 'Consider the >> _results_ of the following script:' I originally tried to attach the >> results I obtained, which showed no change in color for the markers in the >> legend, while the line connecting the markers in the legend did change color. > > Actualy your question is correctly posted but I misread it. Calling > set_color changes only the line color, not the markers. This is > expected and documented behavoir. There are separate methods for the > markers: > > line[0].set_markerfacecolor > line[0].set_markeredgecolor > > See > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D > > Regards > > Goyo
Goyo, Again I thank you for taking time to look into this. You are correct that there are separate functions for setting the marker properties vs the line properties. However, I have tried your solution, and it does not work. Given the following code: import pylab pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='') pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-') leg=pylab.legend(loc='best') line=leg.get_lines() line[0].set_markerfacecolor('black') line[1].set_markerfacecolor('black') pylab.draw() I still do not get black markers. Furthermore, if you try to make a new legend with the result of leg.get_lines(), you will get lines without markers, which leads me to the conclusion I stated in my previous email (which you did not copy) >> I suspect that this is because the legend marker is drawn separately from >> the legend line to accommodate the numpoints argument of the legend >> functions. Then the question is how to access these markers if they are >> separate from the line2d objects in the legend. I didn't even see them in >> the children of the legend [legend.get_children()]. Thanks, Sterling ------------------------------------------------------------------------------ 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