Try the clipplot function from the TeachingDemos package: > x <- rnorm(50) > y <- rnorm(50) > plot(x,y) > clipplot( abline(lm(y~x), col='red'), xlim=c(1,3)) > clipplot( abline(lm(y~x), col='blue'), xlim=c(-2,1))
Hope this helps, -- 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 BBands > Sent: Tuesday, January 16, 2007 9:16 AM > To: R-Help > Subject: [R] plot portion of a line > > Dear HelpeRs, > > Given: > x <- rnorm(50) > y <- rnorm(50) > plot(x,y) > abline(lm(x ~ y)) > > Is there a way to plot just a portion of the line? Say for values of x > > 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.) > > Thank you, > > jab > -- > John Bollinger, CFA, CMT > www.BollingerBands.com > > If you advance far enough, you arrive at the beginning. > > ______________________________________________ > 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.