Skip to content
Prev 319329 / 398506 Next

Fine control of plot

Hi and thank you for your answer.?

Sorry for the html post, here's the code: (you missed a break line between +x and plot(...)?

layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(6,2), heights=c(1,1))?

x = 1:100?
y = rnorm(x)+x?
plot(x,y)?

reg = lm(y~x)?
abline(reg, col = "red")?

plot(1, type="n", axes=F, xlab="", ylab="", xlim = c(-1,1), ylim = c(min(y), max(x)))?
segments(-0.25,min(reg$fitted.values),0.25,min(reg$fitted.values))?
segments(-0.25,max(reg$fitted.values),0.25,max(reg$fitted.values))?
segments(0,min(reg$fitted.values),0,max(reg$fitted.values))?

I hope my question is more obvious after you urn this example.?

Regards,?
Phil