Panel Function for Display Marked by groups
panel.superpose.RdThese are panel functions for Trellis displays useful when a grouping
variable is specified for use within panels. The x (and
y where appropriate) variables are plotted with different
graphical parameters for each distinct value of the grouping variable.
Usage
panel.superpose(x, y = NULL, subscripts, groups,
panel.groups = "panel.xyplot",
...,
col, col.line, col.symbol,
pch, cex, fill, font,
fontface, fontfamily,
lty, lwd, alpha,
type = "p",
grid = lattice.getOption("default.args")$grid,
distribute.type = FALSE)
panel.superpose.2(..., distribute.type = TRUE)
panel.superpose.plain(...,
col, col.line, col.symbol,
pch, cex, fill, font,
fontface, fontfamily,
lty, lwd, alpha)Arguments
- x,y
Coordinates of the points to be displayed. Usually numeric.
- panel.groups
The panel function to be used for each subgroup of points. Defaults to
panel.xyplot.To be able to distinguish between different levels of the originating group inside
panel.groups, it will be supplied two special arguments calledgroup.numberandgroup.valuewhich will hold the numeric code and factor level corresponding to the current level ofgroups. No special care needs to be taken when writing apanel.groupsfunction if this feature is not used.- subscripts
An integer vector of subscripts giving indices of the
xandyvalues in the original data source. See the corresponding entry inxyplotfor details.- groups
A grouping variable. Different graphical parameters will be used to plot the subsets of observations given by each distinct value of
groups. The default graphical parameters are obtained from the"superpose.symbol"and"superpose.line"settings usingtrellis.par.getwherever appropriate.- type
Usually a character vector specifying how each group should be drawn. Formally, it is passed on to the
panel.groupsfunction, which must know what to do with it. By default,panel.groupsispanel.xyplot, whose help page describes the admissible values.The functions
panel.superposeandpanel.superpose.2differ only in the default value ofdistribute.type, which controls the way thetypeargument is interpreted. Ifdistribute.type = FALSE, then the interpretation is the same as forpanel.xyplotfor each of the unique groups. In other words, iftypeis a vector, all the individual components are honoured concurrently. Ifdistribute.type = TRUE,typeis replicated to be as long as the number of unique values ingroups, and one component used for the points corresponding to the each different group. Even in this case, it is possible to request multiple types per group, specifyingtypeas a list, each component being the desiredtypevector for the corresponding group.If
distribute.type = FALSE, any occurrence of"g"intypecauses a grid to be drawn, and all such occurrences are removed beforetypeis passed on topanel.groups.- grid
Logical flag specifying whether a background reference grid should be drawn. See
panel.xyplotfor details.- col
A vector color specification. See Details.
- col.line
A vector color specification. See Details.
- col.symbol
A vector color specification. See Details.
- pch
A vector plotting character specification. See Details.
- cex
A vector size factor specification. See Details.
- fill
A vector fill color specification. See Details.
- font, fontface, fontfamily
A vector color specification. See Details.
- lty
A vector color specification. See Details.
- lwd
A vector color specification. See Details.
- alpha
A vector alpha-transparency specification. See Details.
- ...
Extra arguments. Passed down to
panel.superposefrompanel.superpose.2, and topanel.groupsfrompanel.superpose.- distribute.type
logical controlling interpretation of the
typeargument.
Details
panel.superpose divides up the x (and optionally
y) variable(s) by the unique values of
groups[subscripts], and plots each subset with different
graphical parameters. The graphical parameters (col.symbol,
pch, etc.) are usually supplied as suitable atomic vectors, but
can also be lists. When panel.groups is called for the
i-th level of groups, the corresponding element of each
graphical parameter is passed to it. In the list form, the individual
components can themselves be vectors.
The actual plot for each subgroup is created by the
panel.groups function. With the default panel.groups,
the col argument is overridden by col.line and
col.symbol for lines and points respectively, which default to
the "superpose.line" and "superpose.symbol" settings.
However, col will still be supplied as an argument to
panel.groups functions that make use of it, with a default of
"black". The defaults of other graphical parameters are also
taken from the "superpose.line" and "superpose.symbol"
settings as appropriate. The alpha parameter takes it default
from the "superpose.line" setting.
panel.superpose and panel.superpose.2 differ essentially
in how type is interpreted by default. The default behaviour
in panel.superpose is the opposite of that in S, which is the
same as that of panel.superpose.2.
panel.superpose.plain is the same as panel.superpose,
except that the default settings for the style arguments are the
same for all groups and are taken from the default plot style.
It is used in xyplot.ts.
See also
Different functions when used as panel.groups gives different
types of plots, for example panel.xyplot,
panel.dotplot and panel.average (This can
be used to produce interaction plots).
See Lattice for an overview of the package, and
xyplot for common arguments (in particular, the
discussion of the extended formula interface and the groups
argument).
Author
Deepayan Sarkar Deepayan.Sarkar@R-project.org
(panel.superpose.2 originally contributed by Neil Klepeis)