| register_layout | R Documentation |
Register a new layout algorithm that can be used for network visualization.
register_layout(name, layout_fn)
name |
Character. Name of the layout. |
layout_fn |
Function. A function that computes node positions. Should accept a CographNetwork object and return a matrix with x, y columns. |
Invisible NULL.
# Register a simple random layout under a new name. Registering an existing
# name (for example "random") would replace the built-in layout for the rest
# of the session, so pick a name of your own.
register_layout("my_random", function(network, ...) {
n <- network$n_nodes
cbind(x = stats::runif(n), y = stats::runif(n))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.