loess_smooth | R Documentation |
Add a smooth curve computed by loess
to a scatter plot.
loess_smooth(x, ...)
## S3 method for class 'formula'
loess_smooth(formula, data, ...)
## Default S3 method:
loess_smooth(
x,
y = NULL,
...,
conf = 0.95,
n = 50L,
sd = TRUE,
fix_extremes = FALSE
)
## S3 method for class 'loess_smooth'
print(x, ...)
## S3 method for class 'loess_smooth'
plot(
x,
y,
...,
col.line = 1L,
col.ci = col.line,
alpha.ci = 0.5,
xlab = NULL,
ylab = NULL,
ci = c("none", "lines", "band")
)
x, y |
the x- and y-axes for the plot |
... |
additional arguments passed to or from other methods |
formula |
a formula of the form |
data |
a data frame (or list) from which the variables in
|
conf |
the confidence interval to calculate |
n |
the number of points at which to evaluate the smooth curve |
sd |
logical; if |
fix_extremes |
logical; if |
col.line, col.ci |
colors for the smoothed curve and confidence intervals (lines or band) |
alpha.ci |
alpha transparency for the confidence band |
xlab, ylab |
the x- and y-axis labels |
ci |
type of confidence interval to plot, one of |
loess.smooth
plot(mpg ~ wt, mtcars)
lo <- loess_smooth(mpg ~ wt, mtcars)
lines(lo$x, lo$y)
lines(lo$x, lo$upper, lty = 2)
lines(lo$x, lo$lower, lty = 2)
plot(lo)
plot(lo, ci = 'lines')
plot(lo, ci = 'band')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.