plotpolyf: Plot Polygonal Domain on Image of Bivariate Function

Description Usage Arguments Author(s) Examples

View source: R/plotpolyf.R

Description

Produces a combined plot of a polygonal domain and an image of a bivariate function, using either lattice::levelplot or image.

Usage

1
2
3
plotpolyf(polyregion, f, ..., npixel = 100, cuts = 15,
  col = rev(heat.colors(cuts + 1)), lwd = 3, xlim = NULL, ylim = NULL,
  use.lattice = TRUE, print.args = list())

Arguments

polyregion

a polygonal domain. The following classes are supported: "owin", "gpc.poly", "SpatialPolygons", "Polygons", and "Polygon" (for these we have an internal xylist method).

f

a two-dimensional real function. As its first argument it must take a coordinate matrix, i.e., a numeric matrix with two columns, and it must return a numeric vector of length the number of coordinates.

...

further arguments for f.

npixel

numeric vector of length 1 or 2 setting the number of pixels in each dimension.

cuts

number of cut points in the z dimension. The range of function values will be divided into cuts+1 levels.

col

colour vector used for the function levels.

lwd

line width of the polygon edges.

xlim, ylim

numeric vectors of length 2 setting the axis limits. NULL means using the bounding box of polyregion.

use.lattice

logical indicating if lattice graphics (levelplot) should be used.

print.args

a list of arguments passed to print.trellis for plotting the produced "trellis" object (given use.lattice = TRUE). The latter will be returned without explicit printing if print.args is not a list.

Author(s)

Sebastian Meyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
### a polygonal domain (a rounded version of spatstat.data::letterR$bdry)
letterR <- list(
    list(x = c(3.9, 3.8, 3.7, 3.5, 3.4, 3.5, 3.7, 3.8, 3.8, 3.7,
               3.7, 3.5, 3.3, 2, 2, 2.7, 2.7, 2.9, 3, 3.3, 3.9),
         y = c(0.7, 1.1, 1.3, 1.7, 1.8, 1.9, 2.1, 2.3, 2.5, 2.8, 3,
               3.2, 3.3, 3.3, 0.7, 0.7, 1.7, 1.7, 1.5, 0.7, 0.6)),
    list(x = c(2.6, 2.6, 3, 3.1, 3.2, 3.1, 3.1, 3),
         y = c(2.2, 2.7, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2))
)

### f: isotropic exponential decay
fr <- function(r, rate = 1) dexp(r, rate = rate)
fcenter <- c(2,3)
f <- function (s, rate = 1) fr(sqrt(rowSums(t(t(s)-fcenter)^2)), rate = rate)

### plot
plotpolyf(letterR, f, use.lattice = FALSE)
plotpolyf(letterR, f, use.lattice = TRUE)

polyCub documentation built on Oct. 2, 2017, 5:03 p.m.