Learn R Programming

pcds (version 0.1.2)

plotDeltri: The scatterplot of points from one class and plot of the Delaunay triangulation of the other class

Description

Plots the scatter plot of Xp points together with the Delaunay triangles based on the Yp points. Both sets of points are of 2D.

See (okabe:2000,ceyhan:comp-geo-2010,sinclair:2016;textualpcds) for more on Delaunay triangulation and the corresponding algorithm.

Usage

plotDeltri(
  Xp,
  Yp,
  main = "",
  xlab = "",
  ylab = "",
  xlim = NULL,
  ylim = NULL,
  ...
)

Arguments

Xp

A set of 2D points whose scatterplot is to be plotted.

Yp

A set of 2D points which constitute the vertices of the Delaunay triangles.

main

An overall title for the plot (default="").

xlab, ylab

Titles for the \(x\) and \(y\) axes, respectively (default="" for both).

xlim, ylim

Two numeric vectors of length 2, giving the \(x\)- and \(y\)-coordinate ranges (default=NULL for both)

Additional plot parameters.

Value

A scatterplot of Xp points and the Delaunay triangulation of Yp points.

References

See Also

plot.triSht in interp package

Examples

Run this code
# NOT RUN {
nx<-20; ny<-4;  #try also nx<-40; ny<-10 or nx<-1000; ny<-10;

set.seed(1)
Xp<-cbind(runif(nx),runif(nx))
Yp<-cbind(runif(ny),runif(ny))

oldpar <- par(no.readonly = TRUE)
plotDeltri(Xp,Yp,xlab="",ylab="",main="X points and Delaunay Triangulation of Y points")

P<-c(.6,.4)
plotDeltri(P,Yp,xlab="",ylab="",main="X points and Delaunay Triangulation of Y points")

plotDeltri(Xp,Yp,xlab="",ylab="")
plotDeltri(Xp,Yp[1:3,],xlab="",ylab="")

plotDeltri(Xp,rbind(Yp,Yp),xlab="",ylab="")

dat.fr<-data.frame(a=Xp)
plotDeltri(dat.fr,Yp,xlab="",ylab="")

dat.fr<-data.frame(a=Yp)
plotDeltri(Xp,dat.fr,xlab="",ylab="")
par(oldpar)

# }

Run the code above in your browser using DataLab