Re: [R] plot portion of a line

From: Greg Snow <Greg.Snow_at_intermountainmail.org>
Date: Tue 16 Jan 2007 - 22:20:52 GMT


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@intermountainmail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@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@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.
Received on Wed Jan 17 09:26:48 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 Jan 2007 - 00:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.