[R] linear line in x, y plot
David Winsemius
dwinsemius at comcast.net
Mon Oct 28 17:21:21 CET 2013
On Oct 28, 2013, at 8: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)
That is not the problem.
>
> 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)
> seq(-0.08, -0.02, len = -0.02)
integer(0)
The length argument to seq doesn't make any sense. Please review:
?seq
--
David
> 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
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
Alameda, CA, USA
More information about the R-help
mailing list