I am exploring the features of networkD3, diagonalNetwork
function.
Below is the toy example
library(networkD3)
URL <- paste0(
"https://cdn.rawgit.com/christophergandrud/networkD3/",
"master/JSONdata//flare.json")
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
Flare$children = Flare$children[1:3]
diagonalNetwork(List = Flare, fontSize = 10, opacity = 0.9)
I am wondering if there is any option to color just the edges under the node cluster. This is not important but just trying to aim for perfection.
Thanks in advance.
Not directly, but if you know the indices of the links you want to color, you can inject some JavaScript into the linkColour argument like this...
library(networkD3)
URL <- paste0(
"https://cdn.rawgit.com/christophergandrud/networkD3/",
"master/JSONdata//flare.json")
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
Flare$children = Flare$children[1:3]
linkColourJS <- JS(paste0('function(d, i) { return i > 24 && i < 29 ? "red" : "#ccc"; }'))
diagonalNetwork(List = Flare, fontSize = 10, opacity = 0.9, linkColour = linkColourJS)