latticeCombineLayer: Combine Multiple Lattice Plots Layerwise

View source: R/latticeCombineLayer.R

latticeCombineLayerR Documentation

Combine Multiple Lattice Plots Layerwise

Description

This function combines multiple lattice plot objects drawing each as a layer on top of the previous plots. Note that the global plot settings (e.g. 'xlim', 'ylim', ...) are taken from the first object. This is particularly useful when looping over large amounts of data using lapply() (see Examples).

Usage

latticeCombineLayer(trellis.list, ...)

Arguments

trellis.list

A list containing lattice plot objects.

...

Additional arguments passed to latticeExtra::as.layer().

Value

A single lattice plot object.

Author(s)

Tim Appelhans

See Also

latticeExtra::as.layer().

Examples

library(latticeExtra)
dat <- list(1:10,
            10:1,
            3:7,
            7:3)

plist <- lapply(seq(dat), function(i) {
 tmp <- xyplot(dat[[i]] ~ seq(dat[[i]]),
               type = "l", col = i)
})

p <- latticeCombineLayer(plist)

print(p)


Orcs documentation built on Jan. 6, 2023, 5:14 p.m.