opa <- par(mfrow=c(1,3))
L <- simplenet
X <- runifpoint(20, Window(simplenet))
plot(L)
plot(X, add=TRUE, cols="green", pch=16, cex=2)
plot(addVertices(L, X, "nearest"), col="red")
plot(L, add=TRUE, col="grey", lwd=3)
plot(X, add=TRUE, cols="green", pch=16, cex=2)
plot(addVertices(L, X, "vertices"), col="red")
plot(L, add=TRUE, col="grey", lwd=3)
plot(X, add=TRUE, cols="green", pch=16, cex=2)
par(opa)
Run the code above in your browser using DataLab