4.7.other.panel.functions | R Documentation |
In development panel functions for use with lattice
parHandler(scheme = NULL, ...)
#related
getArgs(source = TRUE, local.resets = TRUE,
user.resets = TRUE, is.scales.lines = FALSE,
elements = NULL, ..., defaults = list(),
defaults.only = FALSE)
getPlotArgs(defaults.as = "axis.line", source = TRUE,
local.resets = TRUE, user.resets = TRUE,
elements = NULL, ..., is.scales.lines = NULL,
defaults.only = TRUE)
isGood4LOA(arg)
scheme |
The color scheme to apply. This can be a list of parameters to apply
or a character vector for a pre-defined scheme. Current pre-defined schemes include
|
source , local.resets , user.resets |
When recovering plot arguments
with |
is.scales.lines |
When recovering arguments with |
elements |
When recovering arguments with |
... |
Other arguments, often ignored. |
defaults , defaults.only , defaults.as |
When recovering arguments with |
arg |
For |
getArgs
returns a list of parameters/values based on
lattice
, developer and user settings. If multiple
elements are identified as containing case-specific information,
the list will contain one list of plot parameters for each named
element.
getPlotArgs
is a variation of getArgs
intended for use with panel...
and l...
type
lattice
functions. It returns a list of plot parameters
for different plot components, e.g. symbols, lines, or text.
isGood4LOA
is a simple workhorse that checks if a
supplied arg
should be used by loa
. (See value and
note below.)
parHandler
manages the default appearance of plots.
getArgs
and getPlotArgs
return lists of located
parameters/values. For example, the call
getPlotArgs(default.as = "axis.line")
returns a list containing the lattice
defaults for an axis
line (alpha
, col
, lty
and lwd
) These
can then be used in combination with appropriate x
and
y
values in llines
, or panel.lines
calls.
The arguments local.resets
and user.resets
can
be added into the call to provide developer and user overrides.
(See note below.)
isGood4LOA
returns a logical (TRUE
or FALSE
),
depending on the type of a supplied argument. This returns
FALSE
for NULL
, for all FALSE
logicals, and
any arg that has previously been tagged as 'not wanted'.
parHandler
returns a list a list suitable for use as
par.settings
with most lattice
plots.
getPlotArgs
is intended as a 'workhorse' for plot developers,
to recover lattice
settings, impose their own preferences on
these, and in turn to provide users with similar options to quickly
override developer settings.
isGood4LOA
only exists because I, perhaps wrongly,
equate arg = NULL
with arg = FALSE
when that
argument is a component of a plot defined in the plot formals.
For example, in trianglePlot
I want
grids = NULL
to turn off the plot grids much like
grids = FALSE
, but got fed up always writing the same
everywhere. Does not mean it is right, particularly useful or
even clever...
The getPlotArgs
/isGood4LOA
combination is a first attempt
at providing plot developers with a simple tool to integrate plot argument
management by lattice, the plot developer and the plot user. It is intended
to be applied in the form shown in the Examples below.
Axis, tick, grid and annotation handling in trianglePlot
is
intended to illustrate this type of application.
Karl Ropkins
These function makes extensive use of code developed by others.
lattice: Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5
In other packages: See xyplot
in lattice
.
#getPlotArgs/isGood4LOA notes
#in formals
#my.plot <- function(..., user.reset = TRUE, ...)
#in main code body
#local.resets <- [what developer wants]
#plot.arg <- getPlotArgs("[type]", source, local.reset, user.reset)
#in panel call
#(for panel off/on control)
#if(isGood4LOA(plot.arg)) panel...(..., plot.arg,...)
#in panel... function
#for panel component off/on control)
#if(isGood4LOA(plot.arg1)) panel...(..., plot.arg1,...)
#if(isGood4LOA(plot.arg2)) l...(..., plot.arg2,...)
#etc.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.