The question is to specify two different colors based on the Value or weight of the link using networkD3::forceNetwork
in R. For example, Blue
for the weight of links more than 1, dark
for the weight of links less than 1.
Example code, copied from here (the forceNetwork
section):
library(networkD3)
# Load data
data(MisLinks)
data(MisNodes)
# Plot
forceNetwork(Links = MisLinks, Nodes = MisNodes,
Source = "source", Target = "target",
Value = "value", NodeID = "name",
Group = "group", opacity = 0.8)
A d3-js related question is here (I know nothing about JS so far).