[R] linear line in x, y plot

Ahmed Attia ahmedatia80 at gmail.com
Mon Oct 28 16:30:54 CET 2013


Hi

I have a question about drawing a linear line in x, y plot. I usually
use the following code, but for this time the x values are to small
(-0.08 to -0.02)

I wrote the following code, but r does not draw the line. However, it
does not give an error when it takes the code.


reg1<- lm(CWSI~NWI, data=Ahmed)

NWI <- seq(-0.08, -0.02, len = -0.02)
lines(NWI, predict(reg1, list(NWI =
NWI)),xlim=c(-0.08,-0.02),ylim=c(0,1),pch=1,col=1,lwd=2, lty=1)

When I wrote the following code

abline(reg1,pch=2,col=2,lwd=2, lty=2,xlim=c(-0.06,-0.02),ylim=c(0.3,0.8))

the line shows up, but I can not control the xlim or ylim. It bascally
goes across the figure

I appreciate your help
-- 
Ahmed M. Attia


Research Assistant
Dept. Of Soil&Crop Sciences
Texas A&M University
ahmed.attia at ag.tamu.edu
Cell phone: 001-979-248-5215



More information about the R-help mailing list