Learn R Programming

loa (version 0.3.1.1)

4.3.lims.and.scales.handlers: Plot lims and scales handlers

Description

In development functions for lims and scales handling with lattice plots.

Usage

limsHandler(x=NULL, y=NULL, z=NULL, ..., lim.borders = 0.05)

localScalesHandler(scales = NULL, ..., allowed.scales =c("x", "y"), disallowed.scales = NULL, remove.box = FALSE)

panel.localScale(x.loc, y.loc, lim, ..., panel.scale = NULL, label.before = TRUE, x.offset = NULL, y.offset = NULL, axis = TRUE, ticks = TRUE, annotation = TRUE)

yscale.component.log10(...)

xscale.component.log10(...)

Value

limsHandler returns a list containing ...lim ranges for any of the elements x, y and/or z supplied to it.

localScalesHandler returns a list containing the elements: scales, panel.scales and possibly

par.settings. scales turns off the standard axes annotation. panel.scales is a list of named elements, one per named axis, describing the axis layout. If

remove.box = TRUE, the additional argument par.settings

is also supplied.

All arguments should be passed on to the associated plot.

panel.scales or axis-specific elements in panel.scales

can then be evaluated by an associated panel... function run from within the lattice plot call. This would typically take the form:

panel.my.axis(panel.scale = panel.scale$axis, ...)

panel.localScale is a local axis/scale plotter. It can be used in combination with localScalesHandler, and should called once for each axis that is required, or it can be used 'stand alone' panel to add a local scale to a lattice plot.

yscale.component.log10 and xscale.component.log10 are simple axis transforms for use with log to the base 10 transformed plot axes.

Arguments

x, y, z

x, y and/or z data series.

lim.borders

numeric vector, giving the relative border to extend ...lim ranges by when generating axes or scales. The lim.borders are relative proportions. So, the default setting of 0.05 adds an extra +/- 5% to the data range. If multiple values are supplied the first three are treated as x, y and z lim.borders, respectively. If less than three values are supplied, the three values are generated by wrapping. So, the default setting of 0.05 is equivalent to c(0.05, 0.05, 0.05).

scales, panel.scale

A list of elements like the scales argument used with lattice functions. Current default elements draw (= TRUE), arrows (= FALSE), tick.number (= 5), abbreviate (= FALSE), minlength (= 4), and tck (= 1).

...

Additional arguments.

allowed.scales

A character vector containing the names of the axes to be generated for as part of a local axis.

disallowed.scales

A character vector containing the names of any axes that are not required. Note: If found, these are removed from scales before evaluation.

remove.box

A logical, default FALSE. Should the box lattice typically places around standard plots be removed? This can be useful if you are using a panel... function to generate axes within the plot.

x.loc, y.loc, lim

two member vectors setting the x and y locations where the scale is to be drawn (x.loc ans y.loc), and the limits of the range to be annotated on the scale (lim). Note: These are currently handled 'as is', i.e. for both locations and limit, the first element is the start point and the second is the end point, and any other elements are ignored.

label.before, x.offset, y.offset

Scale annotation overrides. label.before is a logical, which controls the position of annotation, tick marks and/or arrows, etc relative to the scale line (i.e., above/left before or below/right after). By default panel.localScale generates tick marks and labels at right angles to the scale line/axis. x.offset and y.offset force the offsets when adding tick marks and annotation.

axis,ticks,annotation

If supplied, fine controls for the appearance of the axis line, axis tick marks and axis annotation on the generated scale. These can be vectors, in which they are assumed to be color assignments, or lists of common plot parameters, such as col, lty, lwd, etc.

Author

Karl Ropkins

Details

limsHander generates xlim, ylim and/or zlim ranges for axes or color scales for use in a range of plots.

localScalesHandler provides a relatively crude mechanism for the removal of conventional lattice plot axes and the generation of alternative axes using a panel... function like panel.localScale.

References

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

See Also

In other packages: xyplot in lattice.

Examples

Run this code

## See trianglePlot Example 2 for example application

Run the code above in your browser using DataLab