'Is there a possibility to feed in a layout to forceNetwork {networkD3}?
I have a large network with different components (smaller graphs which are not connected to each other). I love the networkD3 package and the forceNetwork it produces. But I miss the opportunity to specify the layout of the network. In my large network (not shown here), with forceNetwork the network components overlap in the middle but I need to show how many components my network has. I could do that with the "nicely" layout of ggraph as shown below.
Is there a possibility to specify the layout in forceNetwork such as with ggraph? Or is there the possibility to specify in forceNetwork that it should NOT place the different components of the network above each other?
Example in ggraph:
set.seed(234)
g <- disjoint_union(
sample_pa(10,directed = F),
sample_pa(20,directed = F),
sample_pa(30,directed = F),
sample_pa(40,directed = F),
sample_pa(50,directed = F),
sample_pa(60,directed = F),
sample_pa(80,directed = F)
)
ggraph(g,layout = "nicely") +
geom_edge_link0() +
geom_node_point() +
theme_graph()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

