# F_1_panel.xyplot

0th

Percentile

##### Default Panel Function for xyplot

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.

Keywords
dplot
##### Usage
panel.xyplot(x, y, type = "p",
groups = NULL,
pch, col, col.line, col.symbol,
font, fontfamily, fontface,
lty, cex, fill, lwd,
horizontal = FALSE, …,
grid = FALSE, 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 consisting of one or more of the following: "p", "l", "h", "b", "o", "s", "S", "r", "a", "g", "smooth", and "spline". If type has more than one element, an attempt is made to combine the effect of each of the components.

The behaviour if any of the first six are included in type is similar to the effect of type in plot (type "b" is actually the same as "o"). "r" adds a linear regression line (same as panel.lmline, except for default graphical parameters). "smooth" adds a loess fit (same as panel.loess). "spline" adds a cubic smoothing spline fit (same as panel.spline). "g" adds a reference grid using panel.grid in the background (but using the grid argument is now the preferred way to do so). "a" has the effect of calling panel.average, which can be useful for creating interaction plots. The effect of several of these specifications depend on the value of horizontal.

Type "s" (and "S") sorts the values along one of the axes (depending on horizontal); this is unlike the behavior in plot. For the latter behavior, use type = "s" with panel = panel.points.

See example(xyplot) and demo(lattice) for examples.

groups

an optional grouping variable. If present, panel.superpose will be used instead to display each subgroup

col, col.line, col.symbol

default colours are obtained from plot.symbol and plot.line using trellis.par.get.

font, fontface, fontfamily

font used when pch is a character

pch, lty, cex, lwd, fill

other graphical parameters. fill serves the purpose of bg in points for certain values of pch

horizontal

A logical flag controlling the orientation for certain type's, e.g., "h", "s", ans "S".

Extra arguments, if any, for panel.xyplot. In most cases panel.xyplot ignores these. For types "r" and "smooth", these are passed on to panel.lmline and panel.loess respectively.

grid

A logical flag, character string, or list specifying whether and how a background grid should be drawn. This provides the same functionality as type="g", but is the preferred alternative as the effect type="g" is conceptually different from that of other type values (which are all data-dependent). Using the grid argument also allows more flexibility.

Most generally, grid can be a list of arguments to be supplied to panel.grid, which is called with those arguments. Three shortcuts are available:

TRUE:

roughly equivalent to list(h = -1, v = -1)

"h":

roughly equivalent to list(h = -1, v = 0)

"v":

roughly equivalent to list(h = 0, v = -1)

No grid is drawn if grid = FALSE.

abline

A numeric vector or list, specifying arguments arguments for panel.abline, which is called with those arguments. If specified as a (possibly named) numeric vector, abline is coerced to a list. This allows arguments of the form abline = c(0, 1), which adds the diagonal line, or abline = c(h = 0, v = 0), which adds the x- and y-axes to the plot. Use the list form for finer control; e.g., abline = list(h = 0, v = 0, col = "grey").

For more flexibility, use panel.abline directly.

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.

panel.superpose, xyplot, splom

• panel.xyplot
• panel.splom
• panel.qq
##### Examples
# NOT RUN {
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))]

# }

Documentation reproduced from package lattice, version 0.20-38, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.