Visualizing acyclic graph using Sankey diagram

Post date: Jul 18, 2015 9:52:11 AM

Here is an example.

# ============================ # my simple example # ============================ library(RCurl) # create weighted edges # graph must be acyclic # The number must start with 0 s = c(0, 0, 1, 1, 1, 2, 2) target = c(1, 2, 2, 3, 4, 5, 6) value = c(5, 8, 10, 20, 30, 40, 50) mylink = data.frame(s, target, value) # create node names name = c('begin', 'A', 'B', 'C', 'D', 'E', 'F') mynode = data.frame(name) # plot the Sankey diagram sankeyNetwork(Links = mylink, Nodes = mynode, Source = "s", Target = "target", Value = "value", NodeID = "name", width = 700, fontSize = 12, nodeWidth = 30)

There are a few more cool interactive visualization from networkD3 by Christopher Gandrud & JJ Allaire.