christophergandrud / networkD3

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

The order of the node in the saved html files is different from what I saw in R. #195

Closed JialiJIN closed 7 years ago

JialiJIN commented 7 years ago

I used the saveNetwork to create the html. But every time when I saved the sankeynetwork and opened the html files, the order of the nodes in the html is different from the viewer pane in R. But when I used another laptop, they are the same. Since I am not familiar with javascript, I have no idea about it. viewer in html use chrome viewer in r

christophergandrud commented 7 years ago

Hm, this seems like it would be a difficult issue to troubleshoot if the problem is specific to certain hardware. Have you tried it in different browsers on the same computer?

JialiJIN commented 7 years ago

YES! I tried the Internet Explorer, but it is the same as what I opened in chrome. Do you think if I save the network graph as a tiff or .pdf file directly will make sense? AND does nerworkd3 have this conversion function? Thanks for your quick reply!

christophergandrud commented 7 years ago

If you save it as a PNG that should lock it in place (obviously it won't be interactive). Checkout https://christophergandrud.github.io/networkD3/ for an example of how to do this in RStudio (it's at the bottom). Though this functionality has been buggy due to issues on the RStudio side.

cjyetman commented 7 years ago

Are you sure the data you pass to the function is exactly the same on both machines? Looks like they're alphabetical (bottom to top) in the first and not in the second (probably order of nodes in the passed data).

JialiJIN commented 7 years ago

Yeah! I figured out the problems finally!!!! I found the order of the nodes name is different when I reshape the data. So I just reordered the nodes name and it works! Thanks for reminding me.