Help with coloring nodes and edges in Igraph

Hello there,

I want to color the individual edges so that they take on the colors of the node they start from. Unfortunately my code doesn't work.

Beispiel_1X

The code looks like this:

NEWC0 <- as.matrix(NEWC0)
gnewc0 <- graph_from_adjacency_matrix(NEWC0, mode=c("directed"), weighted=TRUE, diag=FALSE, add.colnames=NULL, add.rownames=NA)
E(gnewc0)$width <- E(gnewc0)$weight /5

edge.start <- ends(gnewc0, es=E(gnewc0), names=F)[,1]

edge.col <- V(gnewc0)$color[edge.start]

plot(gnewc0, vertex.color = c("gray50", "tomato", "gold", "blue", "limegreen", "orange", "wheat", "orchid", "red", "olivedrab", "yellow", "skyblue", "darkmagenta", "green", "orangered2", "darkslateblue", "lightblue"), vertex.frame.color = "black", vertex.label.cex = 0.9, vertex.label.color = "black", vertex.label.distance = 200, vertex.label.font = 1, edge.arrow.size = 0.3, vertex.size = 12, vertex.frame.color="black", edge.curved=.1, edge.color=edge.col)

What should I change?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.