4.2.plot.structure.handlers: Handler functions for plot structure arguments.

4.2.plot.structure.handlersR Documentation

Handler functions for plot structure arguments.


Function(s) for handling (front end) plot arguments like x and strip that manage the plot structure.


  formulaHandler(x, data = NULL, groups = NULL, ..., 
        expand.plot.args = TRUE, formula.type = "z~x*y|cond", panel.zcases = FALSE, 
        coord.conversion = NULL, lattice.like = NULL, check.xy.dimensions = TRUE, 
        check.coord.dimensions = TRUE, get.zcase.dimensions = TRUE, 
        output = "extra.args")

  matrixHandler(x, data = NULL, row.values=NULL, column.values=NULL, 

  stripHandler(..., striplab=NULL)




(For formulaHandler) A formula or matrix (matrixHandler) intended to be used to generate a lattice plot. See Below.


If supplied, the assumed source of the elements of formula x, typically a data.frame.


If supplied, the grouping argument to be used with x and data.


Additional arguments are passed on to related functions.


For formulaHandler only, logical. Should any short elements of the plot structure be expanded?


For formulaHandler only, character vector or function. The plot structure to be used when generating the plot, e.g. z ~ x * y | cond for loaPlot


For formulaHandler only, logical. Should zcase arguments, e.g. z1 and z2 in z1 + z2 ~ x * y | cond, be treated as panel conditioning terms rather than grouping terms?


For formulaHandler only, function. If supplied, the conversion to use to convert coordinate information supplied using other coordinate systems to (x, y).


For formulaHandler only, list. For preprocessing, a list of plot terms that can be passed directly to lattice/loa plots.

check.xy.dimensions, check.coord.dimensions

For formulaHandler only, logicals. Should the formula structure be tested before attempting to generate the plot? See Note below.


For formulaHandler only, logical. Should the dimensions of any multiple zcases b calculated? See Note below.


For formulaHandler only, character vector. The format to return function output in.

row.values, column.values

For matrixHandler only, row and column values to be assigned to supplied matrix x.


For stripHandler only, character vector. If supplied, the label to add to the panel strip when conditioning is applied. By default, it applies the standard lattice convention, i.e., show for numerics.


formulaHandler manages the formula component or x element of of loa plot functions.

For example, for loaPlot it assumes the general formula structure z ~ x * y | cond, and applies it in a similar fashion to the lattice function levelplot.

Within the formula part of the plot call x and y are the horizontal and vertical axes, z is any additional information to be used in point, symbol, surface or glyph generation, and cond any additional conditioning to be applied. (The coordinates, x and y, are required elements; z and cond are typically optional.)

matrixHandler converts a matrix supplied as x element of a loa plot to a formula and associated data. If row.values and column.values are supplied, these are used as (x,y) values for the supplied matrix.

stripHandler manages the strip component of loa plot functions.

getZcaseDimensions tracks the dimensions of multiple z


formulaHandler returns a list, containing the plot elements defined in the supplied formula.

matrixHandler returns a list containing all supplied arguments, subject to the following modifications: matrix x converted to formula (z~x*y); data, replaced with supplied matrix content; xlim and ylim, added is not suppied.

stripHandler returns a list containing all supplied arguments, subject to the following modifications: strip, Updated or generated if not supplied; striplab, added to strip via the strip argument var.name, if this is undeclared in call.

getZcaseDimensions returns a list containing all the supplied arguments, plus two additions arguments (if supplied in the call): zcase.zlim and z.rowsum.lim. zcase.zlim is a list of lim values, one for each zcase. z.rowsum.lim is the range of 'by-row' sums of zcases. These are calculated using any zcase information supplied in the call.


These function are in development and may be subject to changes.

The current version of formulaHandler includes code from the stats function get_all_vars. It operates in a similar fashion to the previous version but checks zcase dimensions.

The previous version of formulaHandler was a wrapper for the lattice function latticeParseFormula. This version of formulaHandler was updated to simplify multiple z argument handling.

The latest version of formulaHandler includes more flexible formula.type handling. For example, it can now handle formulas that have more than two coordinates. As a result the check.xy.dimensions argument was replaced with a check.coord.dimensions argument. The previous argument will however remain in the function formals and function as before until all related code has been updated.

The latest version of formulaHandler uses getZcaseDimensions to calculate the dimensions of z if it is multi-part, e.g. z1 + z2 + etc ~ x * y rather than z ~ x * y.

The current version of matrixHandler is based on code from levelplot.matrix in lattice. If used with x and data arguments it will overwrite data with the matrix content.


Karl Ropkins


This 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

See Also

In loa: loaPlot; panelPal

In other packages: levelplot in lattice.

loa documentation built on July 12, 2024, 3:01 p.m.