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? Paul Rydelek, Ph.D. 5232 Dorset Dr. Memphis, TN 38117
abline; setting plot limits
6 messages · Paul Rydelek, Duncan Murdoch, David L Carlson +2 more
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(). Duncan Murdoch
Paul Rydelek, Ph.D. 5232 Dorset Dr. Memphis, TN 38117
______________________________________________ R-help at r-project.org 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.
You can also use clip() before abline():
x <- rnorm(25) y <- rnorm(25) plot(y~x) clip(min(x), max(x), min(y), max(y)) abline(lm(y~x))
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. David Carlson -----Original Message----- 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(). Duncan Murdoch
Paul Rydelek, Ph.D. 5232 Dorset Dr. Memphis, TN 38117
______________________________________________ R-help at r-project.org 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 at r-project.org 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.
On 15/06/14 15:34, 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?
A function with this capability was posted by Remko Duursma on 22/1/09. See:
cheers, Rolf Turner P. S. Jim: Perhaps this function could/should be added to plotrix. If you are interested, I have written a help file for it. R. T.
On Mon, 16 Jun 2014 08:54:41 AM Rolf Turner wrote:
On 15/06/14 15:34, 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?
A function with this capability was posted by Remko Duursma on
22/1/09. See:
http://article.gmane.org/gmane.comp.lang.r.general/137344/match=ablinepiec
e
cheers, Rolf Turner P. S. Jim: Perhaps this function could/should be added to plotrix. If you are interested, I have written a help file for it. R. T.
Hi Rolf and others, In fact Remko contributed that function to plotrix - ablineclip. Jim
On 16/06/14 12:35, Jim Lemon wrote:
On Mon, 16 Jun 2014 08:54:41 AM Rolf Turner wrote:
On 15/06/14 15:34, 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?
A function with this capability was posted by Remko Duursma on
22/1/09. See:
e
cheers, Rolf Turner P. S. Jim: Perhaps this function could/should be added to plotrix. If you are interested, I have written a help file for it. R. T.
Hi Rolf and others, In fact Remko contributed that function to plotrix - ablineclip.
Sorry. Wasn't aware of ablineclip(). Actually that function seems to use a quite different approach from that of ablinepiece(), and to be a substantial improvement. Thanks for pointing it out to us. cheers, Rolf