[R] abline; setting plot limits
David L Carlson
dcarlson at tamu.edu
Sun Jun 15 19:00:21 CEST 2014
You can also use clip() before abline():
> x <- rnorm(25)
> y <- rnorm(25)
> clip(min(x), max(x), min(y), max(y))
But the clipping region will affect anything else you add to the plot after the clip command. In package plotrix, ablineclip() sets and resets the clipping region.
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Duncan Murdoch
Sent: Sunday, June 15, 2014 10:55 AM
To: Paul Rydelek; r-help at r-project.org
Subject: Re: [R] abline; setting plot limits
On 14/06/2014, 11:34 PM, Paul Rydelek wrote:
> Relatively new user with a question regarding abline.
> I want to draw a st. line fit to some data but I want the line to span
> the range of the x-data and NOT the plot limits.
> In short the line spans xmin to xmax(of plot axis) but I want it to
> span xmin to xmax (of x data).
> Can this but done with abline or do I have to use lines and construct
> the line from a+bx?
You can use lines() or segments(), you can't use abline().
> Paul Rydelek, Ph.D.
> 5232 Dorset Dr.
> Memphis, TN 38117
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
R-help at r-project.org mailing list
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