visLayout | R Documentation |
Network visualization layout options. For full documentation, have a look at visDocumentation.
visLayout( graph, randomSeed = NULL, improvedLayout = NULL, clusterThreshold = NULL, hierarchical = NULL )
graph |
: a visNetwork object |
randomSeed |
: Number. When NOT using the hierarchical layout, the nodes are randomly positioned initially. This means that the settled result is different every time. If you provide a random seed manually, the layout will be the same every time. Ideally you try with an undefined seed, reload until you are happy with the layout and use the getSeed() method to ascertain the seed. |
improvedLayout |
: Boolean. Default to true. When enabled, the network will use the Kamada Kawai algorithm for initial layout. For networks larger than 100 nodes, clustering will be performed automatically to reduce the amount of nodes. This can greatly improve the stabilization times. If the network is very interconnected (no or few leaf nodes), this may not work and it will revert back to the old method. Performance will be improved in the future. |
clusterThreshold |
: Number. Default to 150. Cluster threshold to which improvedLayout applies. |
hierarchical |
: Boolean. Default to false. When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can use visHierarchicalLayout |
See online documentation https://datastorm-open.github.io/visNetwork/
visNodes for nodes options, visEdges for edges options, visGroups for groups options, visLegend for adding legend, visOptions for custom option, visLayout & visHierarchicalLayout for layout, visPhysics for control physics, visInteraction for interaction, visNetworkProxy & visFocus & visFit for animation within shiny, visDocumentation, visEvents, visConfigure ...
nodes <- data.frame(id = 1:10) edges <- data.frame(from = round(runif(8)*10), to = round(runif(8)*10)) # fix seed, so you retrieve same network each time...! visNetwork(nodes, edges) %>% visLayout(randomSeed = 123) visNetwork(nodes, edges) %>% visLayout(randomSeed = 123) # hierarchical visNetwork(nodes, edges) %>% visLayout(hierarchical = TRUE) visNetwork(nodes, edges) %>% visHierarchicalLayout(direction = "LR")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.