2

I have created a network graph in R using networkD3.

The graph looks so congested.

enter image description here

So i tried to increase the distance between edges. when I pass in some value through linkDistance, the whole shape is distorted and some nodes disappear. I gave some arbitrary value 10 for all the edges.

enter image description here

What am I doing wrong?

  • 1
    Edit your question and add data plus code to reproduce the effect. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example . E.g. this works fine: `library(networkD3); data(MisLinks); data(MisNodes); forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source", Target = "target", Value = "value", NodeID = "name", Group = "group", linkDistance = 100)`. – lukeA Dec 30 '15 at 12:39

1 Answers1

2

The linkDistance looks like to be a value to multiple the distance between nodes. Maybe you should change this to 2 or 3?

For linkDistance you can use javascript functions like:

value <- 1.3
linkDistance=JS('function(d) {', paste('return d.value *', value,';'), '}'))
Marcin
  • 7,834
  • 8
  • 52
  • 99
  • Hi Marcin, do you mind taking a look at a related networkD3 question? http://stackoverflow.com/questions/35280218/r-networkd3-package-node-coloring-in-simplenetwork – warship Feb 09 '16 at 02:01