If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep. Vars. I would like to produce a plot with both: col2=f(col1) and col3=f(col1). How do I do this such that I can control line parameters (line type, color, etc). I know that if I stack the data and col2 and col3 are treated as different factor levels, that I can accomplish this, but lose control over the line parameters. Any guidance is greatly appreciated. Bill
Hi Bill (or William) What plot do you want to create ? (scatter plot, boxplot, so on?) ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Fri, Apr 30, 2010 at 5:42 PM, William Clapham < William.Clapham@ars.usda.gov> wrote:> If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep. > Vars. I would like to produce a plot with both: col2=f(col1) and > col3=f(col1). How do I do this such that I can control line parameters > (line type, color, etc). I know that if I stack the data and col2 and col3 > are treated as different factor levels, that I can accomplish this, but > lose > control over the line parameters. Any guidance is greatly appreciated. > > Bill > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
It depends on what kind of plot etc and which package you are using. The basic plot routines are summarized in ?plot.default with many of the parameters controlled by ?par I think at the simplist something like this would work and you can add colour plotting specs etc as you experiment. This assumes col1, c2 and col3 are separate vectors. plot(col, col2) lines(col1,col3) The package ggplot does very nice graphs but completely differently :) --- On Fri, 4/30/10, William Clapham <William.Clapham at ARS.USDA.GOV> wrote:> From: William Clapham <William.Clapham at ARS.USDA.GOV> > Subject: [R] Newbie question > To: r-help at r-project.org > Received: Friday, April 30, 2010, 10:42 AM > If I have 3 columns of data, col 1 > Independent Var; cols 2 and 3 are Dep. > Vars.? I would like to produce a plot with both:? > col2=f(col1) and > col3=f(col1).? How do I do this such that I can > control line parameters > (line type, color, etc).? I know that if I stack the > data and col2 and col3 > are treated as different factor levels, that I can > accomplish this, but lose > control over the line parameters.? Any guidance is > greatly appreciated. > > Bill > > ______________________________________________ > 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. >