Generate spatial layout using spatstat
igraph or metanet object
A spatstat window object (owin), e.g. disc(), owin(poly=...); Or sf object.
Type of distribution: "random", "regular"
"surface", "boundary"
for surface-regular, defalut 0
Optional curved attribute for coors
order nodes according to a node attribute
manual the discrete variable with a vector, or continuous variable with "desc" to decreasing
random seed
rescale the coordinates to (0,1)
A coors object (data.frame with class "coors" and attribute "curved")
# \donttest{
if (requireNamespace("spatstat.geom") && requireNamespace("spatstat.random")) {
poly_x <- c(0, 2, 2, 0)
poly_y <- c(0, 0, 1, 1)
win_poly <- spatstat.geom::owin(poly = list(x = poly_x, y = poly_y))
plot(win_poly)
coors1 <- spatstat_layout(co_net, win_poly, type = "regular", mode = "surface")
plot(co_net, coors = coors1)
coors2 <- spatstat_layout(co_net2, win_poly, type = "random", mode = "boundary")
plot(co_net2, coors = coors2)
if (requireNamespace("sf")) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
poly <- nc[1, ]
coors <- spatstat_layout(go = multi1, win = poly, type = "regular", mode = "surface")
plot(multi1, coors = coors)
}
}
#> Loading required namespace: spatstat.geom
# }