2013-07-11 126 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