plot.ashape {alphahull} | R Documentation |
This function returns a plot of the \alpha
-shape. If desired, it also adds the Delaunay triangulation and Voronoi diagram of the sample.
## S3 method for class 'ashape'
plot(x, add = FALSE, wlines = c("none", "both", "del", "vor"),
wpoints = TRUE, number = FALSE, col = NULL,
xlim = NULL, ylim = NULL, lwd = NULL, ...)
x |
Object of class |
add |
Logical, if TRUE add to a current plot. |
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 and the |
... |
Arguments to be passed to methods, such as graphical parameters (see |
## Not run:
# Uniform sample of size n=300 in the annulus B(c, 0.5)\B(c, 0.25)
# with c=(0.5, 0.5).
n <- 300
theta<-runif(n,0,2*pi)
r<-sqrt(runif(n,0.25^2,0.5^2))
x<-cbind(0.5+r*cos(theta),0.5+r*sin(theta))
# Value of alpha
alpha <- 0.1
# alpha-shape
ashape.obj <- ashape(x, alpha = alpha)
# Plot alpha-shape in blue, sample points in black,
# and Delaunay triangulation in red
plot(ashape.obj, wlines= "del", col = c(4, 1, 2))
# 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-shape
ashape.obj <- ashape(x, alpha = alpha)
# Plot alpha-shape in blue
plot(ashape.obj, col = c(4, 1))
## End(Not run)