John Sorkin
2009-May-07 12:00 UTC
[R] Generating plots with two lines, each line plotted with a different color
R 2.9.0 windows xp I would like to have the two lines generated by my plot have different colors, in addition to the two different line types specified by the plot command below. I would appreciate advice on how I can specify line colors. plot(survfit(Surv(Age,Died) ~ Rx, data = GVHDdata),lty=c(1,2),lwd=2) Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC, University of Maryland School of Medicine Claude D. Pepper OAIC, University of Maryland Clinical Nutrition Research Unit, and Baltimore VA Center Stroke of Excellence University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) jsorkin at grecc.umaryland.edu Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}
Zeljko Vrba
2009-May-07 12:06 UTC
[R] Generating plots with two lines, each line plotted with a different color
On Thu, May 07, 2009 at 08:00:59AM -0400, John Sorkin wrote:> I would like to have the two lines generated by my plot have different colors, in addition to the two different line types specified by the plot command below. I would appreciate advice on how I can specify line colors. > > plot(survfit(Surv(Age,Died) ~ Rx, data = GVHDdata),lty=c(1,2),lwd=2) >Try adding col=c("red","blue") as additional parameter.
Thomas Lumley
2009-May-07 14:11 UTC
[R] Generating plots with two lines, each line plotted with a different color
On Thu, 7 May 2009, John Sorkin wrote:> R 2.9.0 > windows xp > > I would like to have the two lines generated by my plot have different colors, in addition to the two different line types specified by the plot command below. I would appreciate advice on how I can specify line colors. > > plot(survfit(Surv(Age,Died) ~ Rx, data = GVHDdata),lty=c(1,2),lwd=2) >,col=c("tomato","goldenrod") -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle