Comment 2 for bug 572559

Revision history for this message
Solomon Messing (solomon-messing) wrote : Re: [Bug 572559] Re: tkplot fails for a large graphs in R

Oh ok thank you. I want to hand-place certain nodes in the layout with
tkplot, so I can just set those graph attributes after I call
tkplot.getcoords and then output to PDF as a workaround for now,
correct?

Thank you,

-Solomon

On May 1, 2010, at 1:51 AM, Gábor Csárdi <email address hidden>
wrote:

> 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
> i96e <- remove.vertex.attribute(i96e, "label.color")
> i96e <- remove.vertex.attribute(i96e, "frame.color")
> i96e <- remove.vertex.attribute(i96e, "label.cex")
> tkplot() works, although it is quite slow.
>
> ** Changed in: igraph
> Status: New => Confirmed
>
> ** Changed in: igraph
> Importance: Undecided => Medium
>
> ** Changed in: igraph
> Assignee: (unassigned) => Gábor Csárdi (gabor.csardi)
>
> --
> tkplot fails for a large graphs in R
> https://bugs.launchpad.net/bugs/572559
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in The igraph library: Confirmed
>
> Bug description:
> When I try to use tkplot to manually set layout positions, I get
> this error message:
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"),
> class = "tclObj") :
> [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://stanford.edu/~messing/mag_act96.txt",
> na.strings = "na")
> magact97 = read.delim("http://stanford.edu/~messing/mag_act97.txt",
> na.strings = "na")
> magact98 = read.delim("http://stanford.edu/~messing/mag_act98.txt",
> na.strings = "na")
>
> ################################################################
> # (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(magact96[,-(1:4)]); row.names(g96) = magact96$ID.
> g97 = as.matrix(magact97[,-(1:4)]); row.names(g97) = magact97$ID.
> g98 = as.matrix(magact98[,-(1:4)]); row.names(g98) = magact98$ID.
>
> ################################################################
> # (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(g96e, mode = "undirected")
>
> #Transforms graph so that multiple edges become an attribute ( E(g)
> $weight ) of each unique edge
> E(i96e)$weight <- count.multiple(i96e)
> 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)$weight)/2 +.5
>
> tkplot(i96e)
>
> ======================================================
>
> Thank you,
>
> -Solomon Messing
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/igraph/+bug/572559/+subscribe