Stack plots

Description

Stack plot functions for Lattice.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
   
   stackPlot(x, data = NULL, ...)

   #standard panels

   panel.stackPlot(..., process=TRUE, plot=TRUE, 
            loa.settings = FALSE) 

   #data handlers
   ##currently not exported

Arguments

x

For stackPlot only, a formula with the general structure y ~ x or y1 + y2 ~ x | cond, etc. The elements y1, y2, etc are stacked on the y-axis, and plotted against x. Both are required.

data

For stackPlot only, if supplied, the assumed source of the elements of formula x, typically a data.frame.

...

Additional arguments.

loa.settings, plot, process

loaPlot arguments used to manage panelPal activity.

Details

stackPlot generates a stack plot using the lattice framework.

panel.stackPlot handles the appearance of triangle plot outputs.

Value

stackPlot returns trellis objects, much like conventional lattice plot functions.

panel.stackPlot is intended for use within a trianglePlot function call.

Note

Development:

This is an in-development plot, and 'best handling' strategies have not been decided for several elements. So, future versions of these functions may differ significantly from the current version.

In particular:

stackPlot:

The stackPlot argument x may include conditioning in the form y ~ x | cond. However, exact handling is has not been defined, so may subject to change.

To generate the stacks, stackPlot resets y values by applying y - min(y) to each layer and then stacks them. It also generates a second element y0 of asociated baselines. This is then used in the form x = c(x, rev(x)), y = c(y, rev(y0)) with panel.polygon to generate the stack layers.

panel.stackPlot:

Code currently in revision. Please handle with care.

Author(s)

Karl Ropkins

References

These function makes extensive use of code developed by others.

As elsewhere, the use of lattice is also gratefully acknowledged:

lattice: Sarkar, Deepayan (2008). Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5

See Also

In loa: loaPlot and panelPal.

In other packages: xyplot and panel.polygon in lattice.

Examples

1
2
3
4
5
6
7
8
## Example 1
## Basic stack plot usage

#stackPlot(lead~dist.m, data=lat.lon.meuse)
#stackPlot(cadmium+copper+lead+zinc~dist.m, data=lat.lon.meuse)

stackPlot(cadmium*40+copper*5+lead+zinc~dist.m, data=lat.lon.meuse)