On 2013/08/01 4:23 PM, Drain, Theodore R (392P) wrote:
> I have an application where the user can edit line colors and other 
> attributes after the plot is drawn.  The artists update just fine but the 
> legend doesn't change.
>
>>From what I can see in the legend code, it doesn't seem like there is any 
>>mechanism in place for doing this.  Does anyone have any ideas on the best 
>>way to implement something like this?
>
> Here is a simplified script to show the issue:
>
> import pylab as p
> p.ion()
> l = p.plot( [1,2,3], 'b', label="foo" )
> p.legend()
>
> raw_input( "press return..." )
> l[0].set_color( "green" )
> p.draw()
>
> Thanks,
> Ted


If you keep a reference to the Legend object, then you can call its 
get_lines() method to get a list of Line2D objects corresponding to the 
objects returned by plot().  You can use the set_color() method on them.
Maybe this is enough if your application is simple enough.

Eric

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to