|
From: | David Huffaker |
Subject: | [igraph] Overlaying two plots with different vertex sizes |
Date: | Wed, 25 Aug 2010 14:26:56 -0400 |
Hi all, I tried googling this for awhile, but need to turn to the igraph community. I am trying to overlay two graphs (one a friend network, the other an exchange network). However, I'd like to vary the size of the exchange network (right now, as a degree(g)). I get the following error, which I assume is happening because there are less nodes in g than there are in g2. Is there a better way to distinguish the size of the vertices in g? Error in plot.igraph(g, vertex.label = NA, layout = lay, vertex.color = nodecolor, : dims [product 2] do not match the length of object [17] In addition: Warning message: In layout[, 1] + label.dist * cos(-label.degree) * (vertex.size + : longer object length is not a multiple of shorter object length Here is my code: g <- graph.data.frame(dat, directed = T) g2 <- graph.data.frame(dat2, directed = F) nodesize <- scale(degree(g, mode = "out"), center = T) + 5 nodecolor <- "red" lay <- layout.fruchterman.reingold(g2) # If this is changed to "g" only two nodes show up so I use the larger graph for layout. png("final.png") plot.igraph(g2, vertex.label = NA, layout = lay, vertex.color = nodecolor, vertex.size = nodesize, edge.width = 1, edge.color = "gray60", edge.arrow.size = 0.5) par(new = TRUE) # use this to overlay plots plot.igraph(g, vertex.label = NA, layout = lay, vertex.color = nodecolor, vertex.size = nodesize, edge.width = 1.5, edge.color = "gray20", edge.arrow.size = 0.5) dev.off() Thanks in advance! David |
[Prev in Thread] | Current Thread | [Next in Thread] |