I am creating a graph from an adjacency matrix, and would like to color the edges by the color of the nodes. Do you know how I can do this?
Here is my code, in case it helps:
g1<-graph.adjacency(common
,mod=c('directed')
,weighted=TRUE
,diag=FALSE
,add.colnames=NULL
,add.rownames=NA)
plot(g1
, layout=layout.lgl
, vertex.color=palette(rainbow(26))
, vertex.size=degree(g1)*0.1
, edge.curved=T
, edge.width=edge.betweenness(g1)*0.1
, edge.arrow.size=0.07)
I don't think this is what you are looking for, but all the colors are blue with the code below.
plot(g1
, layout=layout.lgl
, vertex.color="blue"
, vertex.size=degree(g1)*0.1
, edge.color="blue"
, edge.curved=T
, edge.width=edge.betweenness(g1)*0.1
, edge.arrow.size=0.07)
Also, check out help for plot.igraph
which is used when you use plot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.