Hi,

Try

 mylines = plot1.get_lines()
 plot2.legend(mylines, [p.get_label() for p in mylines])

When you call the legend method with two arguments, first argument is
a list of lines and second argument is a list of labels. It does not
seem to matter whether lines are from same axes.
Hope this helps.

-JJ



On Mon, Jul 14, 2008 at 12:47 PM, David Lonie <[EMAIL PROTECTED]> wrote:
> I have an application that has 2 subplots, and I'd like to use the second to
> display the legend for the first. For example, for subplots plot1 and plot2:
>
> plot1.plot((1,2,3,4), label='up', color = 'g')
> plot1.plot((4,3,2,1), label='down', color = 'b')
>
> plot2.legend("What can I put here to display a legend for plot1 on
> plot2???")
>
> Can this be done?
>
> Thanks,
>
> Dave
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to