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) %>%
; 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=
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="
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
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.
#
5 matches
Mail list logo