plot.ahull {alphahull} | R Documentation |
Plot the alpha-convex hull
Description
This function returns a plot of the \alpha
-convex hull. If desired, it also adds the Delaunay triangulation, Voronoi diagram and \alpha
-shape of the sample.
Usage
## S3 method for class 'ahull'
plot(x, add = FALSE, do.shape = FALSE,
wlines = c("none", "both", "del", "vor"), wpoints = TRUE,
number = FALSE, col = NULL, xlim = NULL,
ylim = NULL, lwd = NULL, ...)
Arguments
x |
Object of class |
add |
Logical, if TRUE add to a current plot. |
do.shape |
Logical, indicates if the |
wlines |
"Which lines?". I.e. should the Delaunay triangulation be plotted (wlines='del'), should the Voronoi diagram be plotted (wlines='vor'), should both be plotted (wlines='both'), or none (wlines='none', the default)? |
wpoints |
Logical, indicates if sample points should be plotted. |
number |
Logical, defaulting to FALSE; if TRUE then the points plotted will be labelled with their index numbers. |
col |
The colour numbers for plotting the |
xlim |
The limits on the x-axis. |
ylim |
The limits on the y-axis. |
lwd |
The line widths for plotting the tesselations, the |
... |
Arguments to be passed to methods, such as graphical parameters (see |
See Also
Examples
## Not run:
# Random sample in the unit square
x <- matrix(runif(100), nc = 2)
# Value of alpha
alpha <- 0.2
# alpha-convex hull
ahull.obj <- ahull(x, alpha = alpha)
# Plot including the alpha-convex hull in pink, alpha-shape in blue,
# sample points in black, voronoi diagram in green
# and Delaunay triangulation in red
plot(ahull.obj, do.shape = TRUE, wlines = "both", col = c(6, 4, 1, 2, 3))
# Random sample from a uniform distribution on a Koch snowflake
# with initial side length 1 and 3 iterations
x <- rkoch(2000, side = 1, niter = 3)
# Value of alpha
alpha <- 0.05
# Alpha-convex hull
ahull.obj <- ahull(x, alpha = alpha)
plot(ahull.obj)
## End(Not run)