F_1_panel.xyplot {lattice} | R Documentation |
Default Panel Function for xyplot
Description
This is the default panel function for xyplot
. Also see
panel.superpose
. The default panel functions for
splom
and qq
are essentially the same function.
Usage
panel.xyplot(x, y, type = "p",
groups = NULL,
pch, col, col.line, col.symbol,
font, fontfamily, fontface,
lty, cex, fill, lwd,
horizontal = FALSE, ...,
smooth = NULL,
grid = lattice.getOption("default.args")$grid,
abline = NULL,
jitter.x = FALSE, jitter.y = FALSE,
factor = 0.5, amount = NULL,
identifier = "xyplot")
panel.splom(..., identifier = "splom")
panel.qq(..., identifier = "qq")
Arguments
x , y |
variables to be plotted in the scatterplot |
type |
character vector controlling how The behaviour if any of the first five are included in Type The remaining values of Type See |
groups |
an optional grouping variable. If present,
|
col , col.line , col.symbol |
default colours are obtained from |
font , fontface , fontfamily |
font used when |
pch , lty , cex , lwd , fill |
other graphical parameters. |
horizontal |
A logical flag controlling the orientation for certain
|
... |
Extra arguments, if any, for |
smooth |
If specificied, indicates the type of smooth to be
added. Can be a character vector containing one or more values from
Normally, smoothing is performed with the |
grid |
A logical flag, character string, or list specifying whether and how
a background grid should be drawn. This provides the same
functionality as Most generally,
No grid is drawn if |
abline |
A numeric vector or more generally a list containing arguments that
are used to call For more flexibility, use |
jitter.x , jitter.y |
logical, whether the data should be jittered before being plotted. |
factor , amount |
controls amount of jittering. |
identifier |
A character string that is prepended to the names of grobs that are created by this panel function. |
Details
Creates scatterplot of x
and y
, with various
modifications possible via the type argument. panel.qq
draws a
45 degree line before calling panel.xyplot
.
Note that most of the arguments controlling the display can be
supplied directly to the high-level (e.g. xyplot
) call.
Author(s)
Deepayan Sarkar Deepayan.Sarkar@R-project.org
See Also
panel.superpose
,
xyplot
,
splom
Examples
types.plain <- c("p", "l", "o", "r", "g", "s", "S", "h", "a", "smooth")
types.horiz <- c("s", "S", "h", "a", "smooth")
horiz <- rep(c(FALSE, TRUE), c(length(types.plain), length(types.horiz)))
types <- c(types.plain, types.horiz)
x <- sample(seq(-10, 10, length.out = 15), 30, TRUE)
y <- x + 0.25 * (x + 1)^2 + rnorm(length(x), sd = 5)
xyplot(y ~ x | gl(1, length(types)),
xlab = "type",
ylab = list(c("horizontal=TRUE", "horizontal=FALSE"), y = c(1/6, 4/6)),
as.table = TRUE, layout = c(5, 3),
between = list(y = c(0, 1)),
strip = function(...) {
panel.fill(trellis.par.get("strip.background")$col[1])
type <- types[panel.number()]
grid::grid.text(label = sprintf('"%s"', type),
x = 0.5, y = 0.5)
grid::grid.rect()
},
scales = list(alternating = c(0, 2), tck = c(0, 0.7), draw = FALSE),
par.settings =
list(layout.widths = list(strip.left = c(1, 0, 0, 0, 0))),
panel = function(...) {
type <- types[panel.number()]
horizontal <- horiz[panel.number()]
panel.xyplot(...,
type = type,
horizontal = horizontal)
})[rep(1, length(types))]