Hello to all,
I managed to get a social network of interactions between individuals from the following code:
#Layout Options
set.seed(3952) # set seed to make the layout reproducible
layout1 <- layout.fruchterman.reingold(go_Graph)
#Node or Vetex Options: Size and Color
V(go_Graph)$color <- "grey"
V(go_Graph)[degree(go_Graph, mode="in")>5]$color <- "yellow" #Destinguishing High Degree Nodes as yellow
V(go_Graph)$size=degree(go_Graph, mode = "in")*2
#Edge Options: Color
E(go_Graph)$color <- "grey"
plot(go_Graph,
edge.arrow.size=0.25,
edge.arrow.mode = "-",
vertex.label.color= "black")
BUT I also have another df (named go_sexes) with the different nodes ID and the "sex" atribute. I changed it from chr to factor with two layer (Male = M and female = F)
I would like now to make my nodes became a square if it's a male and a circle if it's a female.
I tested as following in "#Node or Vetex Options: Size and Color" section of my script :
V(go_Graph)$shape <- ifelse(go_sexes[V(go_Graph), 2] == "M", "circle", "square") and I have the error : "Error in [<-.igraph.vs
(*tmp*
, oob, value = NA_integer_) :
invalid indexing"
can someone help me please ??
Have a great day.
Hugo