Panel Function to Add a Spline Smooth
panel.spline.RdA predefined panel function that can be used to add a spline smooth based on the provided data.
Usage
panel.spline(x, y, npoints = 101,
lwd = plot.line$lwd,
lty = plot.line$lty,
col, col.line = plot.line$col,
type,
horizontal = FALSE, ...,
keep.data = FALSE,
identifier = "spline")Arguments
- x, y
Variables defining the data to be used.
- npoints
The number of equally spaced points within the range of the predictor at which the fitted model is evaluated for plotting.
- lwd, lty, col, col.line
Graphical parameters for the added line.
col.lineoverridescol.- type
Ignored. The argument is present only to make sure that an explicitly specified
typeargument (perhaps meant for another function) does not affect the display.- horizontal
A logical flag controlling which variable is to be treated as the predictor (by default
x) and which as the response (by defaulty). IfTRUE, the plot is ‘transposed’ in the sense thatybecomes the predictor andxthe response. (The name ‘horizontal’ may seem an odd choice for this argument, and originates from similar usage inbwplot).- keep.data
Passed on to
smooth.spline. The default here (FALSE) is different, and results in the original data not being retained in the fitted spline model. It may be useful to set this toTRUEif the return value ofpanel.spline, which is the fitted model as returned bysmooth.spline, is to be used for subsequent computations.- ...
Extra arguments, passed on to
smooth.splineandpanel.linesas appropriate.- identifier
A character string that is prepended to the names of grobs that are created by this panel function.
Value
The fitted model as returned by smooth.spline.
Author
Deepayan Sarkar Deepayan.Sarkar@R-project.org