I have Networkx 1.6 and Matplotlib 1.1.0 on Windows this is my code:
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)
And I get the error:
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
Does Anyone know how to fix it?
I am not sure what you want to draw exactly but you get a plot of your node doing:
Thus, removing the apparently correct ax parameter allows drawing the figure. I found a post here showing the same error related to the ax parameter. It seems it was working on mpl 0.99 but not in mpl 1.0