How to change a color label node from its id or name?
Ex: I want to change label color node name=”4″ or id=3
g9<- graph(c(0,1,0,2,0,3,1,4,1,2,3,4,3,5,4,5,5,2),n=6,dir=FALSE)
V(g9)$name<-c(1:6)
V(g9)$label<-V(g9)$name
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
V(g9)$coloris an array of colors.To change color of a specific node say 2:
V(g9)$color[2] ="#343434FF"If you want different color for each node, you can specify
rainbow(n)where n is number of nodes and this function generates a array of colors and then you can specify:V(g9)$color=rainbow(9)Also note: To get a list of vertices or nodes you can get them:
V(g9)and then if you decide to change the color of vertex 5, you can use
V(g9)$color[which(V(g9)==5)]="#434344"where,
which(V(g9)==5)matches to vertex or node 5.