R中igraph中的tkplot [英] tkplot in igraph within R

查看:266
本文介绍了R中igraph中的tkplot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码,带有相应的输出

Here is my code with the corresponding output

> tkplot(g.2,vertex.label=nodes,
+   canvas.width=700,
+   canvas.height=700)
[1] 6

> ?tkplot
Warning message:
In rm(list = cmd, envir = .tkplot.env) : object 'tkp.6' not found

无论我在构建并查看绘图后执行什么命令,都会遇到此错误.

I get this error no matter what command I run after building and viewing my plot.

这可能很明显,但我无法了解情节中的数据.

This may be obvious, but I can't get at the data from the plot.

> tkp.6.getcoords
Error: object 'tkp.6.getcoords' not found

有什么想法吗?在Windows 2007 Pro上.

Any thoughts? On Windows 2007 Pro.

推荐答案

R是一种功能编程语言. tkplot有点奇怪(无论如何,对于R用户而言),它返回其创建的数字句柄.尝试以下方法:

R is a functional programming language. tkplot is a bit odd (for R users anyway) in that it returns numeric handles to its creations. Try this instead:

tkplot.getcoords(6)

当我在tkplot页面上运行该示例时,我便从tkplot.getcoords(1)获得了该代码,因为这是我的第一个igraph图:

When I run the example on the tkplot page, I then get this from tkplot.getcoords(1) since it was my first igraph plot:

> tkplot.getcoords(1)
           [,1]      [,2]
 [1,] 334.49319  33.82983
 [2,] 362.43837 286.10754
 [3,] 410.61862 324.98319
 [4,] 148.00673 370.91116
 [5,] 195.69191  20.00000
 [6,]  29.49197 430.00000
 [7,]  20.00000 155.05409
 [8,] 388.51103  62.61010
 [9,] 430.00000 133.44695
[10,] 312.76239 168.90260

这篇关于R中igraph中的tkplot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆