plot.voronoi {voronoifortune} | R Documentation |
Plot Voronoi Tessellation and Delaunay Triangulation
Description
Plot Voronoi tessellation (VT) and Delaunay triangulation (DT).
Usage
## S3 method for class 'voronoi'
plot(x, delaunay = TRUE, voronoi = TRUE,
X = NULL, add = FALSE, asp = 1,
col.delaunay = "red", col.voronoi = "blue", ...)
Arguments
x |
an object of class |
delaunay |
a logical value: draw the DT? |
voronoi |
a logical value: draw the VT? |
X |
a two-column matrix with the original data (site coordinates). |
add |
a logical value. By default, a new plot is made. Setting
|
asp |
a numeric value. By default, both axes are scaled
similarly (isometry). Use |
col.delaunay , col.voronoi |
the colours used for the segments. |
... |
other arguments passed to |
Details
The ...
argument makes plotting very flexible.
The default procedure is to first draw the DT, setting the limits of the axes according to the data, and then to draw the VT. Playing with the different options can change the order these two are drawn.
The Fortune algorithm often adds some vertices which are far from the
data points (sites); so if delaunay = FALSE
, the scales are
likely to extend much more than the default.
The infinite edges of the VT are drawn as dashed lines.
Value
(NULL).
Author(s)
Emmanuel Paradis
See Also
Examples
X <- matrix(runif(200), 100, 2)
res <- voronoi(X)
plot(res)
plot(res, delaunay = FALSE)
dat <- matrix(runif(40), 20, 2)
tess.dat <- voronoi(dat)
op <- par(mar = rep(0, 4))
## pass the data with the X argument:
plot(tess.dat, X = dat, pch = ".", axes = FALSE, ann = FALSE,
xlim = c(-1, 2), ylim = c(-1, 2))
legend("topleft", , c("Delaunay triangulation", "Voronoi tessellation"),
lty = 1, col = c("red", "blue"), bty = "n")
par(op)