On 10/29/2013 02:30 AM, Ahmed Attia wrote:
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

Hi Ahmed,
Have a look at ablineclip in the plotrix package.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to