[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] changing vertex shape according to vertex characteristics

From: Meenakshi Parameshwaran
Subject: [igraph] changing vertex shape according to vertex characteristics
Date: Wed, 3 Apr 2013 21:38:41 +0100

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")

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

myLayout <- layout.fruchterman.reingold(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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]