Useful Panel Functions

These are predefined panel functions available in lattice for use in constructing new panel functions (usually on-the-fly).

panel.abline(a, b, ...)
panel.abline(coef, ...)
panel.abline(reg, ...)
panel.abline(h= ,v= , ...)
panel.curve(expr, from, to, n = 101,
            curve.type = "l", ...)
panel.rug(x = NULL, y = NULL,
          regular = TRUE, start, end, ...)
panel.fill(col="grey", ...)
panel.grid(h=3, v=3, ...)
panel.lmline(x,y,...) = panel.abline(lm(y~x), ...)
panel.loess(x, y, span = 2/3, degree = 1,
            family = c("symmetric", "gaussian"),
            evaluation = 50, ...)
panel.linejoin(x, y, fun = mean, horizontal = TRUE, ...)
panel.mathdensity(dmath = dnorm, args = list(mean=0, sd=1))
x, y
variables defining the contents of the panel
a, b
Coefficients of the line to be added
Coefficients of the line to be added as a length 2 vector
A regression object. The corresponding fitted line will be drawn
For panel.abline, numerical vectors giving y and x locations respectively of horizontal and vertical lines to be added to the plot. For panel.grid, number of horizontal and vertical reference lines to be added to the plot; h=-1 an
expression as a function of x or a function to plot as a curve
the number of points to use for drawing the curve
logical indicating whether `rug' to be drawn on the regular side (left / bottom) or not (right / top)
start, end
endpoints of rug segments, in normalized parent coordinates (between 0 and 1). Defaults depend on value of regular, and cover 3% of the panel width and height
from, to
optional lower and upper x-limits of curve. If missing, limits of current panel are used
type of curve ('p' for points, etc), passed to llines
span, degree, family, evaluation
arguments to loess.smooth, around which panel.loess is essentially a wrapper
the function that will be applied to the subset of x(y) determined by the unique values of y(x)
logical. If FALSE, the plot is `transposed' in the sense that the behaviours of x and y are switched. x is now the `factor'. Interpretation of other arguments change accordingly. See documentation of bwplot for a fuller expla
A vectorized function that produces density values given a numeric vector named x, e.g., dnorm
list giving additional arguments to be passed to dmath
graphical parameters can be supplied. see function definition for details. Color can usually be specified by col, col.line and col.symbol, the last two overriding the first for lines and points respectively.

panel.abline adds a line of the form y=a+bx or vertical and/or horizontal lines. Graphical parameters are obtained from reference.line for panel.grid, and add.line for the others (can be set using trellis.par.set )

panel.curve adds a curve, similar to what curve does with add = TRUE. Graphical parameters for the line are obtained from the add.line setting.

panel.linejoin treats one of x and y as a factor (according to the value of horizontal, calculates fun applied to the subsets of the other variable determined by each unique value of the factor, and joins them by a line. Can be used in conjunction with panel.xyplot and more commonly with panel.superpose to produce interaction plots. See xyplot documentation for an example.

panel.mathdensity plots a (usually theoretical) probability density function. Can be useful in conjunction with histogram and densityplot to visually estimate goodness of fit.

panel.axis draws axis tick marks INSIDE a panel. It honours the (native) axis scales within the panel, but the locations need to be explicitly specified. Used in panel.pairs for splom.

panel.identify is similar to identify. When called as part of the panel function, it waits for the user to identify points (in the panel being drawn) via mouse clicks. Clicks other than left-clicks terminate the procedure. It is less sophisticated than identify in the sense that it does not keep track of points already identified.


panel.abline(a, b = NULL, h = numeric(0), v = numeric(0), col, col.line = add.line$col, lty = add.line$lty, lwd = add.line$lwd, ...) panel.curve(expr, from, to, n = 101, curve.type = "l", col = add.line$col, lty = add.line$lty, lwd = add.line$lwd, type = NULL, ...) panel.rug(x = NULL, y = NULL, regular = TRUE, start = if (regular) 0 else 0.97, end = if (regular) 0.03 else 1, col, ...) panel.linejoin(x, y, fun = mean, horizontal = TRUE, lwd = reference.line$lwd, lty = reference.line$lty, col, col.line = reference.line$col, ...)

See Also

loess.smooth, identify, trellis.par.get

  • panel.functions
  • panel.abline
  • panel.curve
  • panel.rug
  • panel.fill
  • panel.grid
  • panel.lmline
  • panel.loess
  • panel.linejoin
  • panel.mathdensity
Documentation reproduced from package lattice, version 0.10-10, License: GPL version 2 or later

Community examples

Looks like there are no examples yet.