View source: R/plot_multilayer.R
| plot_multilayer | R Documentation |
Converts an EMLN multilayer object to JSON and opens the Multilayer
Network Visualizer in the default web browser.
plot_multilayer(
multilayer,
bipartite = FALSE,
directed = NULL,
port = 8080,
viz_path = NULL,
browser = getOption("browser")
)
multilayer |
A multilayer object (created by |
bipartite |
Logical. Whether the network is bipartite. Defaults to
|
directed |
Logical or NULL. Whether the network is directed. If NULL (default), auto-detected by checking intralayer edge symmetry. |
port |
Integer. Port for the local HTTP server. Default is 8080. |
viz_path |
Character. Path to the multilayer_viz directory. If NULL
(default), uses the |
browser |
Choose the specific browser to open the visualizer.
Defaults to the system default via |
The function:
Converts the multilayer object to JSON via multilayer_to_json
Starts a local HTTP server (using httpuv) that serves the
visualizer app and the network JSON
Opens the browser with auto-load enabled
The server runs in the background. Call httpuv::stopServer(handle) or
close R to stop it. The JSON data is kept in memory and never written to disk.
Invisibly returns the server handle. Use
httpuv::stopServer(handle) to stop the server when done.
The Multilayer Network Visualizer that this function targets is currently in beta. Feedback and bug reports are welcome at https://github.com/Ecological-Complexity-Lab/emln/issues.
multilayer_to_json, create_multilayer_network, load_emln
if (interactive()){
net <- load_emln(60)
srv <- plot_multilayer(net, bipartite = TRUE)
# When done:
httpuv::stopServer(srv)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.