Question

I had some help in the past with getting the coordinates of a network graph plotted in tkplot here. Now I am stumped again.

Here is the output from a new session.

> g <- graph.data.frame(edges, directed=T, vertices=vert)
> summary(g)
Vertices: 436 
Edges: 1856 
Directed: TRUE 
No graph attributes.
Vertex attributes: name.
No edge attributes.
> tkplot(g, vertex.label=vert$label)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
[1] 1

but when I try this, I am getting and error:

> lay <- tkplot.getcoords(1)
Error in eval(expr, envir, enclos) : object 'tkp.1' not found

I am sure this is due to my lack of knowledge on the topic, but what am I missing?

Thanks in advance

Was it helpful?

Solution

Are you sure the last command was run just after calling the tkplot function and the Graph plot is still open? The number, given back before by tkplot, is really 1?

As I do not know anything about your datas, I could play just with the demo datasets, but the following syntax should work for you I suppose:

lay <- tkplot.getcoords(tkplot(g, vertex.label=vert$label))

OTHER TIPS

id=tkplot(g)
l=tkplot.getcoords(id)

Used to work for me, but it's been a while since I used it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top