polyCutout {RSurvey} | R Documentation |
This function excludes data points outside a given polygon.
polyCutout(dat, ply)
dat |
a list containing x , y , and z components, see Value section. |
ply |
a polygon of class gpc.poly-class . |
Returns NA
values for z
when points (x
, y
) are located outside the polygon.
A list containing the following components:
x |
grid point locations in the x-direction. |
y |
grid point locations in the y-direction. |
z |
a matrix of state variable values corresponding to the grid. |
Fisher, J. C.
point.in.polygon
, filled.contour
x11() ply <- as(cbind(c(2, 8, 9, 6, 3), c(3, 1, 4, 8, 6)), "gpc.poly") x <- seq(0, 10, 0.1) y <- seq(0, 10, 0.1) z <- matrix(runif(length(x) * length(y)), nrow = length(y), ncol = length(x)) dat.old <- list(x = x, y = y, z = z) filled.contour(dat.old, plot.axes = {axis(1); axis(2); plot(ply, add = TRUE)}) dat.new <- polyCutout(dat.old, ply) filled.contour(dat.new, color.palette = terrain.colors)