-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Michael Sumner edited this page Nov 3, 2016
·
7 revisions
Welcome to the rangl wiki!
library(spbabel)
data(holey)
d <- sp(holey)
library(gris)
g <- gris(d)
library(dplyr)
plot(g)
segs <- g$bXv %>% split(.$branch_) %>% map_df(function(x) as_tibble(rangl:::path2seg(x$vertex_)), .id = "branch_")
for (i in seq(nrow(segs))) {
pt <- as.matrix(g$v %>% inner_join(data.frame(vertex_ = unlist(segs[i,c("V1", "V2")]))))[,1:2]
segments(pt[1,1], pt[1, 2], pt[2,1], pt[2, 2], lwd = 2)
text(matrix(apply(pt, 2, mean), ncol = 2), lab = as.character(i), pos = sample(4, 1), adj = 4)
}