scatter plot legend

Hello,

I'm looking for the cleanest way to put a sort of legend into a scatter
plot. I want a legend box that says "<blue circle> is something, <red

is somethingelse" and so on. However I can't seem to set line

labels as I can with other kinds of plots, and for some reason legend for
prints the text that I supply vertically (and of course it doesn't print
the <blue circle> or whatever).

Any suggestions? Just paste some text()? (And if I do that, can I get it
to put a <blue circle> next to my label?)

Thanks to the developers of matplotlib and those who contribute support on
this list!

Rich

Hi,

  I had that vertical text problem when i first used legend...until
John showed me my error.

I think:

legend(('aLabel',), 'upper left')
notice that needed , after the 'aLabel'

For more than one line label:

legend(('aLabel1', 'aLabel2', 'aLabel3'), 'upper left')

...i'm still several versions behind the current matplotlib
release, so i don't know if the syntax may be different now.

Hope this helps,

Jim

···

On Mon, 7 Mar 2005, Rich Drewes wrote:

Hello,

I'm looking for the cleanest way to put a sort of legend into a scatter
plot. I want a legend box that says "<blue circle> is something, <red
> is somethingelse" and so on. However I can't seem to set line
labels as I can with other kinds of plots, and for some reason legend for
prints the text that I supply vertically (and of course it doesn't print
the <blue circle> or whatever).

Ah yes, the old tuple trick. Duh. Thanks.

Now the only question remains: is there any way to put the marker
*symbol* itself into the legend too? On a regular (non-scatter) plot's
legend that is taken care of automatically, but in a scatter plot the
'lines' can't be labeled (I think).

Thanks,
Rich

···

On Mon, 7 Mar 2005, Jim Benson wrote:

  I had that vertical text problem when i first used legend...until
John showed me my error.

I think:

legend(('aLabel',), 'upper left')
notice that needed , after the 'aLabel'