简体   繁体   English

R中Igraph中坐标的另一个问题

[英]Another Issue with Coordinates in Igraph for R

I had some help in the past with getting the coordinates of a network graph plotted in tkplot here . 我在过去的一些帮助,让在tkplot绘制网络图的坐标位置 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 提前致谢

Are you sure the last command was run just after calling the tkplot function and the Graph plot is still open? 您确定在调用tkplot函数之后才运行了最后一条命令,并且Graph图仍处于打​​开状态吗? The number, given back before by tkplot, is really 1? tkplot之前返回的数字真的是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))
id=tkplot(g)
l=tkplot.getcoords(id)

Used to work for me, but it's been a while since I used it. 曾经为我工作,但是已经有一段时间了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM