My question is regarding plotting with R using the igraph and tcltk packages. I installed everything, including XQuartz for my Mac OS X 10.10. When I try to plot it, first it starts the interactive window but then immediately crashes with error "1 1". Has anyone had this? Not sure if this is a mac issue or generally an R issue. When I plot it using just the "plot", i.e. not interactively (not "tkplot") - it works.
Basically I want to plot this network but interactively so I can drag the vertices and edges to make the plot better (this is the output of my script if I just do "plot" instead of "tkplot"):
PS: my R version is 3.2.1, igraph version is 1.0.1
PPS: I am running this script using "Rscript script.r" command in terminal.
Here is my code:
library(tcltk)
library(igraph)
el=read.table("myfilename")
el[,1]=as.character(el[,1])
el[,2]=as.character(el[,2])
el=as.matrix(el)
g=graph.edgelist(el[,1:2])
E(g)$weight=as.numeric(el[,3])
V(g)$size=degree(g)*2
V(g)$color <- "white"
E(g)$color <- "black"
a=read.table("somenamesfile",header=TRUE)
V(g)$group=as.character(a$group[match(V(g)$name,a$number)])
tkplot(g,layout=layout.fruchterman.reingold,edge.width=E(g)$weight*300,edge.arrow.size=0.0,vertex.label=V(g)$group)