Re: [R] Legend Position

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Tue, 18 Nov 2008 13:48:07 -0500

Dear Patrick,
Try this:

plot(y, xlab="Survival Time (Months)", ylab="Survival Probability", mark.time=TRUE, col = c("red", "blue"),
main="Kaplan-Meier Curve of Survival Times - Stratified by Group", lwd=3) legend('topright',c("Locally Advanced",
"Metastatic"),lty=1,col.text=c('red','blue'))

See ?legend for more information.

HTH, Jorge

On Tue, Nov 18, 2008 at 1:05 PM, Richardson, Patrick < Patrick.Richardson_at_vai.org> wrote:

> List,
>
> Is there any way to specify the position of the legend from within the
> following code? If so, how can I do it. As it stands it in the bottom left
> corner and I want to move it to the top right. I'm not sure if I can use
> the default "plot" or if I need to go with the lattice package. Suggestions
> much appreciated.
>
> plot(y, xlab="Survival Time (Months)", ylab="Survival Probability",
> mark.time=TRUE, col = c("red", "blue"),legend.text = c("Locally Advanced",
> "Metastatic"),
> main="Kaplan-Meier Curve of Survival Times - Stratified by Group", lwd=3)
>
>
> Thanks,
>
> _____________________________________________
> Patrick Richardson
> Biostatistician - Program of Translational Medicine
> Van Andel Research Institute - Webb Lab
> 333 Bostwick Avenue NE
> Grand Rapids, MI 49503
> ph. 616.234.5787
>
>
> This email message, including any attachments, is for ...{{dropped:13}}



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 18 Nov 2008 - 18:52:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Nov 2008 - 19:31:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive