latticeCombineGrid: Combine multiple lattice plots in a facetted grid (panels)

Description Usage Arguments Value Author(s) See Also Examples

Description

This function combines multiple lattice plot objects in a facetted grid. Note that the global plot settings (e.g. xlim, ylim, ...) are taken from the first object though the user can specify whether scales should be identical or not. This is particularly useful when looping over large amounts of data using lapply (see examples).

Usage

1
2
latticeCombineGrid(trellis.list, between = list(y = 0.3, x = 0.3),
  as.table = TRUE, ...)

Arguments

trellis.list

A list containing lattice plot objects.

between

Space between panels.

as.table

If TRUE (default) drawing is top left to bottom right

...

Additional arguments passed to c.trellis.

Value

A single lattice plot object.

Author(s)

Tim Appelhans

See Also

c.trellis.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#load data
#Use a probability map assuming high potential for city expansion is just 
#resulting from proximity to current urban area:
pred <- raster(system.file("extdata/probability.rst", package = "Orcs"))

#observed city growth between 1990 and 2006
obs <- raster(system.file("extdata/citygrowth.tif", package = "Orcs"))

#masking current urban area since these pixels have no potential for change
mask <- raster(system.file("extdata/citymask.tif", package = "Orcs"))

#create data list
dat <- list(pred, obs, mask)

#create list of lattice plots
plist <- lapply(seq(dat), function(i) {
  spplot(dat[[i]], scales = list(draw = TRUE))
})


#draw individually
plist[[1]]
plist[[2]]
plist[[3]]


#combine to grid, using c(1, 3) layout
p <- latticeCombineGrid(plist, layout = c(1, 3))
print(p)

Orcs documentation built on May 2, 2019, 2:37 a.m.