【发布时间】:2015-03-31 22:51:08
【问题描述】:
我正在尝试可视化使用 igraph 库创建的简单图形。在here 和here 之后,我已经为 Anaconda (2.7.8) 安装了 cairo 及其各自的绑定(当我输入 help('modules') 时我可以看到 cairo)。但是,当我在 sublime text 2 中运行我的代码时,我看不到图像,而是得到sh: open: command not found。我错过了什么吗?这是我的代码
import igraph
g = igraph.Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)])
igraph.summary(g)
print g.degree()
print g.edge_betweenness()
# Drawing a graph
layout = g.layout("kk")
igraph.plot(g, layout = layout)
【问题讨论】:
-
尝试使用:from igraph import * 然后直接使用plot(g, layout = layout)。
标签: python visualization igraph anaconda