christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
650 stars 269 forks source link

Change nodeSize in radialNetwork? #227

Closed dphansti closed 6 years ago

dphansti commented 6 years ago

Great package! I would really like to be able to change the nodesize so that nodes do not overlap. I see that there is not an argument for this. But is there a workaround?

Thanks!

cjyetman commented 6 years ago

All the tree network plotting functions will soon be deprecated and replaced by the new treeNetwork function which is currently in development. You can use devtools::install_github("christophergandrud/networkD3") to install the current dev version.

With the dev version, you can set the node size individually for every node by adding a nodeSize column to your tree network data, for instance...

links <- read.csv(header = T, stringsAsFactors = F, text = '
nodeId,parentId,name,nodeSize
1,,one,10
2,1,two,18
3,1,three,12
4,1,four,20
5,2,five,10
')

treeNetwork(links, direction = "radial")

There is currently a known bug with radial tree plots where the centering is off, but we'd appreciate any feedback/issues about any other problems you find. (And we could use some help documenting these new features if anyone is interested in that.)