2013-07-11 122 views
1

我在想,如果使用tkplot()更改边缘厚度与tkplot(IGRAPH,R)

当我知道你可以通过右键点击边缘,手动更改它这样做有改变刀刃厚度的方法,但我想能够调用一个用于边缘的属性。类似于在igraph中使用正常绘图功能,我可以做edge.width=E(g)$Weight

另外,有没有办法将tkplot作为png保存为不使用其他软件包? 谢谢!

回答

5

是的,您可以更改边缘宽度,实际上它的作用方式与plot()完全相同。

Tk画布不支持PNG格式,因此无法将tkplot()输出保存为PNG格式。如果使用tkplot()来调整坐标,则使用tkplot.getcoords()查询调整后的坐标,然后使用plot()以及这些坐标来创建PNG文件。

library(igraph) 
g <- graph.ring(10) 
id <- tkplot(g, edge.width=1:10) 
## Now adjust the coordinates by hand, and then continue. 
## E.g. I moved vertex 7 to the middle 
co <- tkplot.getcoords(id) 
png("output.png") 
plot(g, layout=co, edge.width=1:10) 
dev.off() 

example output figure

+1

哪一个?边宽或'tkplot.getcoords'?无论如何,我会在一秒之内向他们展示他们。 –

+0

这是为'tkplot.getcoords' ...我已经投了票。 – agstudy