Description Usage Arguments Value Author(s) Examples
Function to test for horizontal AND vertical percolation
1 |
x |
A data.frame with 4 colums of numeric vectors: x0, y0, x1, y1. These vector are the coordinates of line segments ends. See segments. |
xlim |
Numeric 2-dimensional vector with the limits along the abscissas. |
ylim |
Numeric 2-dimensional vector with the limits along the ordinates. |
a list with: p a data.frame in which each row represents a cluster, the column H with value 1 if the cluster percolates Horizontally and a colum V. c connectivity data. g a nrow(x)-dimensional integer vector with the clusters/groups to which line segment belongs to.
Daniella Ayala (daniellaayala@ciencias.unam.mx) and Francisco Mendoza-Torres (mentofran@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x <- data.frame(x0=c(0,2,3,1),
y0=c(1,0,2,1.5),
x1=c(3,5,7,2),
y1=c(0,3,2,1.5))
xlims <- c(1,6); ylims <- c(-1,4)
plotSegments(x, ylim = ylims)
text(x[, 1:2], labels=1:4, pos = 2)
abline(h=ylims, v=xlims, col = 'gray')
pr <- percolate(x, xlim = xlims, ylim = ylims)
g1 <- which(pr$p[, 1] == 1) # cluster ID
selectCluster <- pr$g==g1
segments(x0= x[selectCluster,1], y0=x[selectCluster,2],
x1= x[selectCluster,3], y1=x[selectCluster,4],
col = "green")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.