abline_range: Add a line to a plot

Description Usage Arguments See Also Examples

View source: R/abline_range.R

Description

As abline, but with from and to arguments. If a fitted linear regression model is used as asn argument, it uses the min and max values of the data used to fit the model.

Usage

1
2
abline_range(a = NULL, b = NULL, reg = NULL, from = NULL, to = NULL,
  ...)

Arguments

a

Intercept (optional)

b

Slope (optional)

reg

A fitted linear regression model (output of lm).

from

Draw from this X value

to

Draw to this x value

...

Further parameters passed to segments

See Also

See add_regres_line for adding a regression line with a confidence interval

Examples

1
2
3
4
5
6
7
8
# Add a line manually
with(mtcars, plot(1/wt, mpg, xlim=c(0,0.8), ylim=c(0,40)))
abline_range(0,50,from=0.2, to=0.6)

# Add a line across the range of the data from a regression object
with(mtcars, plot(1/wt, mpg, xlim=c(0,0.8), ylim=c(0,40)))
fit <- lm(mpg ~ I(1/wt), data=mtcars)
abline_range(fit)

RemkoDuursma/nlshelper documentation built on Nov. 29, 2017, 1:13 a.m.