Displaying 1 result from an estimated 1 matches for "placex".
Did you mean:
place
2012 May 22
1
Adding Text to a Plot
...om a linear
regression?
I've just found this tricky one:
# Sample data
x <- sample(1:100,10)
y <- 2+3*x+rnorm(10)
# Run the regression
lm1 <- lm(y~x)
# Plotting
plot(x,y, main="Linear Regression", col="red")
abline(lm1, col="blue")
placex <- par("usr")[1]+.1*(par("usr")[2]-par("usr")[1])
placey1 <- par("usr")[3]+.9*(par("usr")[4]-par("usr")[3])
placey2 <- par("usr")[3]+.8*(par("usr")[4]-par("usr")[3])
# HERE: Is this the right wa...