On Thu, Aug 30, 2012 at 3:26 PM, Goyo <goyod...@gmail.com> wrote:
> 2012/8/28 Sterling Smith <smit...@fusion.gat.com>:
> > List,
> >
> > Consider the following script:
> >
> > 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_color('black')
> > line[1].set_color('black')
> > pylab.draw()
> >
> > I am attaching the results I see with the TkAgg baackend. I am using
> version 1.1.0.
> >
> > I would expect the markers to change colors also. However, I can't seem
> to find the markers recorded in the legend object to be able to change
> them. Is this a bug or a feature (resetting the color could lead to
> inconsistencies between legend and plot)?
>
>
> I think it's a design issue, there's no connection kept between plot
> lines and the legend. You can change colors in the plot an then call
> legend again instead.
>
> Cheers
>
> Goyo
>
>
That is correct. The lines that one obtains from the get_lines() method of
legend are completely new line objects. It is only upon the creation of
those lines (at legend creation) that the lines inherit the plot's line
properties.
Now, in the future, it would be nice for artist objects to have shareable
"styles", in which case an edit to a style in one place effects all artists
with the same style object. But that might be something reserved for
version 2+.
Cheers!
Ben Root
------------------------------------------------------------------------------
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