问题
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