The igraph
package is popular for studying networks of various kinds in R.
The igraph
library comes with its own plotting mechanism, but it is static and
difficult to control.
library(igraph) g <- graph.atlas(900) plot(g)
Recently, the networkD3
package has included a function to make pretty html
plots of graph-style objects. Unfortunately, the networkd3
library is somewhat
picky in its formulation, so we have created a function that will plot the
graph automatically.
library(networkD3) data("MisLinks") data("MisNodes") forceNetwork( Links = MisLinks, Nodes = MisNodes, Source = "source", Target = "target", Value = "value", NodeID = "name", Group = "group", opacity = 0.9 )
The simpleNetwork
function is better than the default plot.igraph
, but
is not flexible enough.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.