knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-Images/" )
library(igraph) library(dplyr) library(magrittr) library(HivePlot)
# load data data(flights) head(flights)
# turn into a graph g <- graph.data.frame(flights, directed=FALSE)
# Perform clustering to determine number of axes # it defaults to walktrap.community but any function that returns a clustering should work g %<>% findAxes V(g)$axis
# calculate the size of the nodes, defaulting to page.rank g %<>% nodeSize V(g)$nodeSize
# find how high up the axis each node should be, defaulting to closeness g %<>% nodePosition V(g)$nodePosition
Until the package for [Sigma.js](https://github.com/jaredlander/sigma)
is ready we will use igraph
for plotting
plot(g, layout=layout_with_hive(g))
The first axis will always be the positive side of the x-axis on the cartesian plane (eventually we will be able to specify a starting offset for this first axis)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.