[R] creating a plot legend
Thomas Lumley
tlumley at u.washington.edu
Mon Feb 24 21:27:03 CET 2003
On Mon, 24 Feb 2003, Jason Bond wrote:
> Thanks so much to all for their help. I was wondering if there was an easy
> way to create legends in R plots. For example, if I am plotting lines for
> subjects in a longitudinal design of the outcome by time for two different
> treatments, where the individual for treatment 1 are plotted in one color,
> and the others are plotted in another. What I would like to do is, for
> example, have a little legend in the bottom right corner which puts the
> line color next to the treatment name. I guess I could start messing with
> magins and try to draw text at given coordinates within the margin, but
> thought I might ask if anyone else has had success with a simpler
> solution. Thanks so much again,
>
The legend() function.
As a meta-answer I would also note that help.search("legend") would have
told you this.
-thomas
More information about the R-help
mailing list