[R] plot portion of a line
Greg Snow
Greg.Snow at intermountainmail.org
Tue Jan 16 23:20:52 CET 2007
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
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] 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 at 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.
>
More information about the R-help
mailing list