This is the default superpanel function for splom
.
panel.pairs(z,
panel = lattice.getOption("panel.splom"),
lower.panel = panel,
upper.panel = panel,
diag.panel = "diag.panel.splom",
as.matrix = FALSE,
groups = NULL,
panel.subscripts,
subscripts,
pscales = 5,
prepanel.limits = scale_limits,
varnames = colnames(z),
varname.col, varname.cex, varname.font,
varname.fontfamily, varname.fontface,
axis.text.col, axis.text.cex, axis.text.font,
axis.text.fontfamily, axis.text.fontface,
axis.text.lineheight,
axis.line.col, axis.line.lty, axis.line.lwd,
axis.line.alpha, axis.line.tck,
...)
diag.panel.splom(x = NULL,
varname = NULL, limits, at = NULL, labels = NULL,
draw = TRUE, tick.number = 5,
varname.col, varname.cex,
varname.lineheight, varname.font,
varname.fontfamily, varname.fontface,
axis.text.col, axis.text.alpha,
axis.text.cex, axis.text.font,
axis.text.fontfamily, axis.text.fontface,
axis.text.lineheight,
axis.line.col, axis.line.alpha,
axis.line.lty, axis.line.lwd,
axis.line.tck,
...)
The data frame used for the plot.
The panel function used to display each pair of variables. If
specified, lower.panel
and upper.panel
are used for
panels below and above the diagonal respectively.
In addition to extra arguments not recognized by panel.pairs
,
the list of arguments passed to the panel function also includes
arguments named i
and j
, with values indicating the
row and column of the scatterplot matrix being plotted.
The panel function used for the diagonals. See arguments to
diag.panel.splom
to know what arguments this function is
passed when called. Use diag.panel=NULL
to suppress plotting
on the diagonal panels.
logical. If TRUE
, the layout of the panels will have origin
on the top left instead of bottom left (similar to
pairs
). This is in essence the same functionality as provided
by as.table
for the panel layout
Grouping variable, if any
logical specifying whether the panel function accepts an argument
named subscripts
.
The indices of the rows of z
that are to be
displayed in this (super)panel.
Controls axis labels, passed down from splom
.
If pscales
is a single number, it indicates the approximate
number of equally-spaced ticks that should appear on each axis. If
pscales
is a list, it should have one component for each
column in z
, each of which itself a list with the following
valid components:
at
: a numeric vector specifying tick locations
labels
: character vector labels to go with at
limits
: numeric 2-vector specifying axis limits (should be
made more flexible at some point to handle factors)
These are specifications on a per-variable basis, and used on all
four sides in the diagonal cells used for labelling. Factor
variables are labelled with the factor names. Use pscales=0
to supress the axes entirely.
A function to calculate suitable axis limits given a single argument
x
containing a data vector. The return value of the function
should be similar to the xlim
or ylim
argument
documented in xyplot
; that is, it should be a numeric
or DateTime vector of length 2 defining a range, or a character
vector representing levels of a factor.
Most high-level lattice plots (such as xyplot
) use the
prepanel
function for deciding on axis limits from data.
This function serves a similar function by calculating the
per-variable limits. These limits can be overridden by the
corresponding limits
component in the pscales
list.
data vector corresponding to that row / column (which will be the same for diagonal ‘panels’).
(scalar) character string or expression that is to be written centred within the panel
numeric of length 2, or, vector of characters, specifying the scale for that panel (used to calculate tick locations when missing)
locations of tick marks
optional labels for tick marks
A logical flag specifying whether to draw the tick marks and labels.
If FALSE
, variable names are shown but axis annotation is
omitted.
A Numeric scalar giving the suggested number of tick marks.
A character or expression vector or giving names to be used for the
variables in x
. By default, the column names of x
.
Color for the variable name in each diagonal
panel. See gpar
for details on this and the
other graphical parameters listed below.
Size multiplier for the variable name in each diagonal panel.
Line height for the variable name in each diagonal panel.
Font specification for the variable name in each diagonal panel.
Color for axis label text.
Size multiplier for axis label text.
Font specification for axis label text.
Line height for axis label text.
Alpha-transparency for axis label text.
Color for the axes.
Line type for the axes.
Line width for the axes.
Alpha-transparency for the axes.
A numeric multiplier for the length of tick marks in diagonal panels.
Further arguments, passed on to panel
, lower.panel
,
upper.panel
, and diag.panel
from panel.pairs
.
Currently ignored by diag.panel.splom
.
Deepayan Sarkar Deepayan.Sarkar@R-project.org
panel.pairs
is the function that is actually used as the panel
function in a "trellis"
object produced by splom
.
splom
Cmat <- outer(1:6,1:6,
function(i,j) hcl.colors(11)[i+j-1]) ## rainbow(11, start=.12, end=.5)[i+j-1])
splom(~diag(6), as.matrix = TRUE,
panel = function(x, y, i, j, ...) {
panel.fill(Cmat[i,j])
panel.text(.5,.5, paste("(",i,",",j,")",sep=""))
})
Run the code above in your browser using DataLab