hchart.igraph | R Documentation |
Plot igraph objects using Highcharts
## S3 method for class 'igraph'
hchart(object, ..., layout = NULL)
object |
An igraph object. |
... |
Additional arguments for the data series (https://api.highcharts.com/highcharts/series). |
layout |
A layout from igraph package. |
if(require("igraph")) {
N <- 40
net <- sample_gnp(N, p = 2 / N)
wc <- cluster_walktrap(net)
V(net)$label <- seq(N)
V(net)$name <- paste("I'm #", seq(N))
V(net)$page_rank <- round(page.rank(net)$vector, 2)
V(net)$betweenness <- round(betweenness(net), 2)
V(net)$degree <- degree(net)
V(net)$size <- V(net)$degree
V(net)$comm <- membership(wc)
V(net)$color <- colorize(membership(wc))
hchart(net, layout = layout_with_fr)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.