abline(a, b) abline(coef) abline(reg) abline(h=, v=)
a
and slope
b
of the
line y=
a
+
b
*x.
lsfit
.
Specifically,
reg$coef
, if it is of length 2,
will be used to define the intercept and slope of the line.
If
reg$coef
is of length 1, it is treated as
the slope of a fit through the origin.
The first two elements are used if
reg$coef
has length greater than 2.
abline
is that the line y=
a
+
b
*x
or the specified horizontal and vertical lines are drawn across the
current plot.
A warning is given if a line does not intersect the plot.
abline
is a generic function; currently there is only the default
method available.
# line with 0 intercept and slope 1 abline(0, 1) # line produced by least-squares fit abline(lsfit(longley.x[, 1], longley.y)) # dotted vertical lines at x==0 and 10 abline(v = c(0, 10), lty = 2)