Re: [R] Adding regression line to each individual plot in a window with multiple plots

2017-01-18 Thread Thierry Onkelinx
Hi Jake, You could consider switching to ggplot2 # create a dummy dataset dataset <- data.frame( XA = rnorm(100), XB = rnorm(100, mean = 10), YA = rnorm(100), YB = rnorm(100, mean = -10) ) # convert it to long format library(tidyr) long <- dataset %>% gather("Xcat", "Xvalue", XA:XB) %>%

Re: [R] Adding regression line to each individual plot in a window with multiple plots

2017-01-17 Thread Jim Lemon
; par(xpd=TRUE) > abline(lm(Growing_season_precipitation~CPITotal)) > par(xpd=NA) > plot(Growing_season_VPD, CPITotal, xaxs = "i", yaxs = "i", xlim = c(0.6, > 1.8), ylim = c(0,30), xlab = "Average daily VPD (kPa)", ylab = "", pch=21, > bg=

Re: [R] Adding regression line to each individual plot in a window with multiple plots

2017-01-17 Thread Jim Lemon
ake William Andrae > Cc: r-help@r-project.org > Subject: Re: [R] Adding regression line to each individual plot in a window > with multiple plots > > Hi Jake, > As I don't have your data set, try this: > > attach(mtcars) > plot(mpg~disp,xaxs="i",yaxs="

Re: [R] Adding regression line to each individual plot in a window with multiple plots

2017-01-17 Thread Jim Lemon
Hi Jake, As I don't have your data set, try this: attach(mtcars) plot(mpg~disp,xaxs="i",yaxs="i") abline(lm(mpg~disp)) Jim On Wed, Jan 18, 2017 at 12:04 PM, Jake William Andrae wrote: > Hi Everyone, > > > > I've constructed a script that adds multiple plots to the plot window, but > I'm having

[R] Adding regression line to each individual plot in a window with multiple plots

2017-01-17 Thread Jake William Andrae
Hi Everyone, I've constructed a script that adds multiple plots to the plot window, but I'm having a bit of trouble adding a regression line to each individual plot. Of course, the regression lines will vary depending on the variables plotted against one another. I've attached the script. #