Dear all,

I am new to igraph and to R. I have a simple problem I hope you can help
with. i am trying to visualise a classroom network and I want the vertices
to have different colours by ethnic minority/majority background, and
different shapes by gender. The colours work ok, but I can't make the
shapes change.

#set color of vertex attribute according to ethmin
V(graph1)$color <- ifelse(ethmin4 == 1, "red", "blue")
V(graph1)$color

#set shape of vertex attribute according to gender
V(graph1)$shape <- ifelse(female4 == 1, "circle", "square")
V(graph1)$shape

myLayout <- layout.fruchterman.reingold(graph1)

plot.igraph(graph1,
            vertex.color = V(graph1)$color,
            vertex.shape = V(graph1)$shape,
            vertex.size = 15,
            edge.color = "black",
            edge.arrow.size = 0.05,
            layout = myLayout
)

But this doesn't work, and I get the following error:

Error in igraph.check.shapes(params("vertex", "shape")) :
  Bad vertex shape(s): NA.

When I type V(graph1)$shape, I get the following so I think that has loaded
correctly. And I think my shape names are correct.

 [1] "square" "circle" "square" "square" "circle" "square" "circle"
"square" "circle" "square"
[11] "circle" "circle" "square" "square" "circle" "circle" "circle" NA
  "square" "circle"
[21] "square"

Any ideas?

Thanks very much,
Meena
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to