igraph包似乎满足您的要求,该功能可以根据需要帮助tkplot()
调整最终布局。
这是一个使用示例:
s <- cbind(A=sample(letters[1:4], 100, replace=TRUE),
B=sample(letters[1:2], 100, replace=TRUE))
s.tab <- table(s[,1], s[,2])
library(igraph)
s.g <- graph.incidence(s.tab, weighted=T)
plot(s.g, layout=layout.circle,
vertex.label=c(letters[1:4],letters[2:1]),
vertex.color=c(rep("red",4),rep("blue",2)),
edge.width=c(s.tab)/3, vertex.size=20,
vertex.label.cex=3, vertex.label.color="white")
Run Code Online (Sandbox Code Playgroud)
使用交互式显示(可以用于rgl
3D 显示),它看起来像(之后我稍微移动了一个顶点):
tkplot(s.g, layout=layout.circle, vertex.color=c(rep("red",4),rep("blue",2)))
Run Code Online (Sandbox Code Playgroud)
最后,您甚至可以将图形导出为最常见的格式,例如dot
graphviz。