tkplot fails for a large graphs in R
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Fix Released
|
Medium
|
Gábor Csárdi |
Bug Description
When I try to use tkplot to manually set layout positions, I get this error message:
Error in structure(
[tcl] expected integer but got "7.199999999999999 7.199999999999999 7.199999999999".
Here is the code necessary to reproduce the error:
=======
# Load the "igraph" library
library("igraph")
# (1) Read in the data files, NA data objects coded as "na"
magact96 = read.delim("http://
magact97 = read.delim("http://
magact98 = read.delim("http://
#######
# (2) Create the attribute data.
magattrib = magact96[,1:4]
#######
#(3) Drop columns so we have a square incidence matrix for each year
g96 = as.matrix(
g97 = as.matrix(
g98 = as.matrix(
#######
# (4) Now produce single mode co-event matrices for each year
g96e = t(g96) %*% g96
g97e = t(g97) %*% g97
g98e = t(g98) %*% g98
i96e = graph.adjacency
#Transforms graph so that multiple edges become an attribute ( E(g)$weight ) of each unique edge
E(i96e)$weight <- count.multiple(
i96e <- simplify(i96e)
# Now plot the first single mode co-event matrices
# Set vertex attributes, making sure to make them slightly transparent by
# altering the gamma via the rgb(r,g,b,gamma) function.
V(i96e)$label = V(i96e)$name
V(i96e)$label.color = rgb(0,0,.2,.8)
V(i96e)$label.cex = .6
V(i96e)$size = 6
V(i96e)$frame.color = NA
V(i96e)$color = rgb(0,0,1,.5)
# Set edge attributes
E(i96e)$color = rgb(.5,.5,0,.2)
# Scale edge width according to edge weight
E(i96e)$width = log(E(i96e)
tkplot(i96e)
=======
Thank you,
-Solomon Messing
Related branches
Changed in igraph: | |
milestone: | none → 0.6 |
OK, there a number of problems here:
1. tkplot does not support different label colors. In your example they are the same color, but the color is set for each vertex individually, and this is not supported. A workaround is to give the label color in the plot() call, or to set the default with igraph.par().
2. NA as frame color is not supported, either. Supply the same color here as for the vertices, to get rid of the frame.
3. label.cex cannot be different for different vertices, either. The same problem as for 'label.color'.
I will fix these, i.e. add support for them in the next version. Thanks for the report!
After running vertex. attribute( i96e, "label.color") vertex. attribute( i96e, "frame.color") vertex. attribute( i96e, "label.cex")
i96e <- remove.
i96e <- remove.
i96e <- remove.
tkplot() works, although it is quite slow.