Learn R Programming

lattice (version 0.22-5)

F_2_panel.spline: Panel Function to Add a Spline Smooth

Description

A 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")

Value

The fitted model as returned by smooth.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.line overrides col.

type

Ignored. The argument is present only to make sure that an explicitly specified type argument (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 default y). If TRUE, the plot is ‘transposed’ in the sense that y becomes the predictor and x the response. (The name ‘horizontal’ may seem an odd choice for this argument, and originates from similar usage in bwplot).

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 to TRUE if the return value of panel.spline, which is the fitted model as returned by smooth.spline, is to be used for subsequent computations.

...

Extra arguments, passed on to smooth.spline and panel.lines as appropriate.

identifier

A character string that is prepended to the names of grobs that are created by this panel function.

Author

Deepayan Sarkar Deepayan.Sarkar@R-project.org

See Also

Lattice, smooth.spline, prepanel.spline