Skip to contents

Plot igraph objects using Highcharts

Usage

# S3 method for class 'igraph'
hchart(object, ..., layout = NULL)

Arguments

object

An igraph object.

...

Additional arguments for the data series (https://api.highcharts.com/highcharts/series).

layout

A layout from igraph package.

Examples


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 <- as.vector(membership(wc))
V(net)$color <- colorize(membership(wc))
hchart(net, layout = layout_with_fr)

}
#> Loading required package: igraph
#> 
#> Attaching package: ‘igraph’
#> The following objects are masked from ‘package:purrr’:
#> 
#>     compose, simplify
#> The following objects are masked from ‘package:dplyr’:
#> 
#>     as_data_frame, groups, union
#> The following objects are masked from ‘package:stats’:
#> 
#>     decompose, spectrum
#> The following object is masked from ‘package:base’:
#> 
#>     union