简体   繁体   English

如何使用R中的d3Network可视化图形

[英]How to visualize the graph using d3Network in R

I'm trying to use a package called d3Network in R to visualize some network and I used the example in R : 我正在尝试在R中使用一个名为d3Network的包来可视化某些网络,我在R中使用了这个例子:

# Load data
data(MisLinks)
data(MisNodes)

# Create graph
d3ForceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
               Target = "target", Value = "value", NodeID = "name",
               Group = "group", opacity = 0.4)

It only gives me a bunch of scripts rather than a plot. 它只给了我一堆脚本而不是一个情节。 I saw this example on the internet and it seems the others have never come cross this kind of issue. 我在互联网上看到了这个例子,似乎其他人从未遇到过这种问题。 So am I doing something wrong or something is missing? 我做错了什么或遗漏了什么? And also I would like to know how to specify the colour of Source nodes and Target nodes. 而且我想知道如何指定Source节点和Target节点的颜色。

Thanks in advance 提前致谢

It seems you are using d3Network package which is old and not supported anymore. 看来你正在使用旧的不再支持的d3Network软件包。 Try using networkD3 package. 尝试使用networkD3包。
The function name is: forceNetwork 函数名称为: forceNetwork

Try this: 试试这个:

library(networkD3)
data(MisLinks)
data(MisNodes)
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             Group = "group", opacity = 1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM