panel.voronoi | R Documentation |
These panel functions for levelplot
can represent irregular (x, y) points with a color covariate.
panel.levelplot.points
simply draws color-coded points.
panel.voronoi
uses the interp or deldir package to
calculate the spatial extension of a set of points in 2 dimensions.
This is known variously as a Voronoi mosaic, a Dirichlet tesselation,
or Thiessen polygons.
panel.voronoi(x, y, z, subscripts = TRUE, at = pretty(z), points = TRUE, border = "transparent", na.rm = FALSE, win.expand = 0.07, use.tripack = FALSE, backend = c("interp", "deldir"), ..., col.regions = regions$col, alpha.regions = regions$alpha) panel.levelplot.points(x, y, z, subscripts = TRUE, at = pretty(z), shrink, labels, label.style, contour, region, pch = 21, col.symbol = "#00000044", ..., col.regions = regions$col, fill = NULL)
x, y, z |
an irregular set of points at locations (x, y) with value z. |
subscripts |
integer vector indicating what subset of x, y and z
to draw. Typically passed by |
at, col.regions, alpha.regions |
color scale definition;
see |
points |
whether to draw the (x, y) points. |
border |
color for polygon borders. |
na.rm |
if |
win.expand |
Defines the rectangular window bounding the polygons. This is a
factor by which to expand the range of the data. Set to 0 to limit
drawing at the furthest data point locations. Applies only for the
|
use.tripack |
Ignored, with a warning if a value is specified. See Details. |
backend |
Character string specifying backend package to use to
calculate the Voronoi mosaic. Defaults to |
... |
Additional arguments; passed to
|
pch, col.symbol |
symbol and border color for points. A filled symbol should be used, i.e. in the range 21-25. |
shrink |
Ignored. |
labels |
Ignored. |
label.style |
Ignored. |
contour |
Ignored. |
region |
Ignored. |
fill |
Ignored. |
Up to version 0.6-29, latticeExtra used the deldir package to
compute the Voronoi mosaic by default, while offering the choice of
using the faster but non-free ACM licensed implementation in the
tripack package by setting use.tripack = TRUE
. Later
versions use the FOSS replacements in interp by default, and
deprecates the use.tripack
argument. The deldir
implementation, which allows polygons to be clipped to a rectangular
window (the win.expand
argument), can still be used using
backend = "deldir"
.
Felix Andrews felix@nfrac.org
tileplot
,
panel.levelplot
,
deldir
## a variant of Figure 5.6 from Sarkar (2008) ## http://lmdvr.r-forge.r-project.org/figures/figures.html?chapter=05;figure=05_06 depth.ord <- rev(order(quakes$depth)) quakes$Magnitude <- equal.count(quakes$mag, 4) quakes.ordered <- quakes[depth.ord, ] levelplot(depth ~ long + lat | Magnitude, data = quakes.ordered, panel = panel.levelplot.points, type = c("p", "g"), aspect = "iso", prepanel = prepanel.default.xyplot) ## a levelplot with jittered cells xyz <- expand.grid(x = 0:9, y = 0:9) xyz[] <- jitter(as.matrix(xyz)) xyz$z <- with(xyz, sqrt((x - 5)^2 + (y - 5)^2)) levelplot(z ~ x * y, xyz, panel = panel.voronoi, points = FALSE) ## hexagonal cells xyz$y <- xyz$y + c(0, 0.5) levelplot(z ~ x * y, xyz, panel = panel.voronoi, points = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.