One approach is to use the clipplot function from the TeachingDemos package. This is probably overkill to load the package for doing this just once, but if you are creating a more complicated graph with several lines limited by their range then this may be of interest.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Nguyen > Dinh Nguyen > Sent: Tuesday, March 20, 2007 5:32 AM > To: r-help@stat.math.ethz.ch > Subject: [R] abline within data range > > Dear R helpers, > > I would like to have abline, for a lm model for example, > lying within data range. Do you know how to get it? > > Thank in advance > > Nguyen D Nguyen > > #CODE > x<- rnorm(200, 35,5) > y<- rnorm(200, 0.87,0.12) > plot(y~x, xlim=c(0,50), pch=17, bty="l") > abline(lm(y~x)) > > # I would like abline is between min(x) and max(x) > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > ______________________________________________ R-help@stat.math.ethz.ch 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.