addSmooth | R Documentation |
Adds a smoothed line to a scatter plot.
addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## Default S3 method: addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## S3 method for class 'list' addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis data. For method |
y |
the y-axis data. Missing values are permitted and ignored in the smooth. |
Smooth |
the name of the smoothing function. See Details. |
... |
additional parameters for the function names in |
Smooth.along |
the data along which the smoother is run. Must be either "x,"
which smooths |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
The value for Smooth
must the name of a smoothing function as a
character string. The default is "loess.smooth" but any smoother that accepts arguments
names x
and y
and other arguments controlling the smooth and returns a list
with components named x
and y
can be used. Examples of other smoothers in base
R are "supsmu" and "smooth.spline."
The current plot information.
If an error is generated from the smoother, then nothing is added to the graph, an error is printed, the returned object contains missing values for the data that should have been plotted, and the explanation is not updated.
addXY
, xyPlot
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSmooth(AA.pl) # For more details of addSmooth see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.