【发布时间】:2011-12-27 11:40:00
【问题描述】:
我在 Windows 上有 Networkx 1.6 和 Matplotlib 1.1.0 这是我的代码:
self.figure = Figure()
self.axes = self.figure.add_subplot(1,1,1)
self.canvas = FigureCanvas(self, -1, self.figure)
G = nx.Graph()
G.add_node(6)
pos = nx.spring_layout(G)
nx.draw(G, pos, ax = self.axes)
我得到了错误:
File "C:\Python27\lib\site-packages\matplotlib\axes.py, line 1374, in _sci
"Argument must be an image, collection, or ContourSet in this Axes"
ValueError: Argument must be an image, collection, or ContourSet in this Axes
有人知道怎么解决吗?
【问题讨论】:
-
networkx网站上有如何绘制networkx图的例子:networkx.lanl.gov/examples/drawing
-
这只是代码的非功能部分。请发布一个功能性的、最少的代码示例,以便我们重现您的问题
-
图形画布可能有问题。但 joaquin 是对的——我们需要查看重现问题的功能代码。
标签: python matplotlib networkx