Skip to content

Instantly share code, notes, and snippets.

@mages
Created March 16, 2014 19:40
Show Gist options
  • Save mages/9588695 to your computer and use it in GitHub Desktop.
Save mages/9588695 to your computer and use it in GitHub Desktop.
require(igraph)
require(googleVis)
g <- graph.tree(24, children = 4)
set.seed(123)
E(g)$weight = rpois(23, 4) + 1
edgelist <- get.data.frame(g)
colnames(edgelist) <- c("source","target","value")
edgelist$source <- LETTERS[edgelist$source]
edgelist$target <- LETTERS[edgelist$target]
plot(
gvisSankey(edgelist, from="source",
to="target", weight="value",
options=list(
sankey="{link: {color: { fill: '#d799ae' } },
node: { width: 4,
color: { fill: '#a61d4c' },
label: { fontName: 'Times-Roman',
fontSize: 14,
color: '#871b47',
bold: true,
italic: true } }}"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment