Change edge thickness in igraph plot R according to Edge Attributes

元气小坏坏 提交于 2020-01-02 00:52:15

问题


I want to change the edge width of my graph to correspond to the edge.betweenness score.

 net <- read.csv("D:/SNA/R/Net.csv")
 att <- read.csv("D:/SNA/R/Att.csv")
 g <- graph.data.frame(net, vertices=att, directed=TRUE)
 pdf("Network.pdf", pointsize=8)
 plot(g, vertex.label=NA, vertex.size=3, edge.width=edge.betweenness(g))
 dev.off()

I have also tried creating the edge betweenness score as an edge weight and assigning it to edge.width argument in the plot function as follows;

plot(g, vertex.label=NA, vertex.size=3, edge.width=E(g)$width

回答1:


Your example should work. Alternatively, you can write

E(g)$weight <- edge.betweenness(g)

before the plotting function.



来源:https://stackoverflow.com/questions/22301119/change-edge-thickness-in-igraph-plot-r-according-to-edge-attributes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!