Hi R coders,
Looking for some help with my sankey diagram.
I'm using networkD3 and created this lovely diagram but am struggling to customize it. I am looking to make the nodes' shape a circle rather than a rectangle and also, make it collapse the linked output nodes when pressing the source nodes.
If anyone can help, it would be greatly appreciated.
Code below:
install.packages("xlsx")
install.packages("d3Network")
install.packages("networkD3")
install.packages("readxl")
install.packages("RCurl")
install.packages("RColorBrewer")
library(xlsx)
library(d3Network)
library(readxl)
library(RCurl)
library(networkD3)
library(ColorBrewer)
links2 <- read_xlsx("C:/Users/astaneva/Desktop/Sankey.xlsx", sheet = "links")
nodes2 <- read_xlsx("C:/Users/astaneva/Desktop/Sankey.xlsx", sheet = "nodes")
sankeyNetwork(Links = links2, Nodes = nodes2, Source = "source",
Target = "target", Value = "value", NodeID = "name",
fontSize = 14, nodeWidth = 12, units = "£",
fontFamily = "sans-serif", iterations = 0)
Ta!