Ulpoad library
g <-visNetwork::visNetwork(nodes, edges, height = "500px", width = "100%") %>%
visNetwork::visIgraphLayout(layout = "layout_as_tree")
# access the x and y co-ordinates to arrange the groups
coords <- g$x$nodes %>%
dplyr::mutate(x = abs(x)) %>%
dplyr::mutate(y = abs(y)) %>%
dplyr::mutate(x = ifelse(group %in% "cytoplasma", -x, x)) %>%
dplyr::select(x, y) %>%
as.matrix()
coords
## x y
## [1,] -1 0.1428571
## [2,] 1 0.4285714
## [3,] -1 0.4285714
## [4,] 1 0.7142857
## [5,] -1 1.0000000
## [6,] 1 1.0000000
## [7,] -1 0.7142857
## [8,] 1 0.7142857
## [9,] -1 0.1428571
## [10,] 1 1.0000000
visNetwork::visNetwork(nodes, edges, height = "500px", width = "100%") %>%
visNetwork::visIgraphLayout(
layout = "layout.norm",
layoutMatrix = coords,
randomSeed = 1,
smooth = T
)