Learn R Programming

polyCub (version 0.5-0)

plotpolyf: Plot Polygonal Domain on Image of Bivariate Function

Description

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

Usage

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

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).
polyregion
a polygonal integration domain. The following classes are supported: "owin", "gpc.poly", "SpatialPolygon
f
two-dimensional function. As its first argument it must take a coordinate matrix, i.e. a numeric matrix with two columns.
...
further arguments for f.

Examples

Run this code
### a polygonal domain
data("letterR", package="spatstat")

### 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)

Run the code above in your browser using DataLab