Hello,
I am going through the quickstart titled "An Example: Building a Price
Network" found here
https://graph-tool.skewed.de/static/doc/quickstart.html#an-example-building…
After running the program, I receive the following output which is
different from what the quickstart suggests should be output. Here is what
I get:
------
vertex: 36063 in-degree: 0 out-degree: 1 age: 36063
vertex: 9075 in-degree: 4 out-degree: 1 age: 9075
vertex: 5967 in-degree: 3 out-degree: 1 age: 5967
vertex: 1113 in-degree: 7 out-degree: 1 age: 1113
vertex: 25 in-degree: 84 out-degree: 1 age: 25
vertex: 10 in-degree: 541 out-degree: 1 age: 10
vertex: 5 in-degree: 140 out-degree: 1 age: 5
vertex: 2 in-degree: 362 out-degree: 1 age: 2
vertex: 0 in-degree: 636 out-degree: 0 age: 0
Nowhere else to go... We found the main hub!
-----
The output from "vertex: 36063 ..." down to "vertex: 5 ..." is as expected,
but at "vertex: 2 ..." onward is different, and I am receiving the
following error message, and the plot fails to be drawn
"ValueError: 'yerr' must not contain negative values"
The full error output is as follows
--------------
ValueError Traceback (most recent call last)
Cell In [2], line 92 89 err[err >= y] = y[err >= y] - 1e-2 91
figure(figsize=(6,4))---> 92 errorbar(in_hist[1][:-1], in_hist[0],
fmt="o", yerr=err, 93 label="in") 94
gca().set_yscale("log") 95 gca().set_xscale("log")
File ~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/matplotlib/pyplot.py:2480,
in errorbar(x, y, yerr, xerr, fmt, ecolor, elinewidth, capsize,
barsabove, lolims, uplims, xlolims, xuplims, errorevery, capthick,
data, **kwargs) 2474 @_copy_docstring_and_deprecators(Axes.errorbar)
2475 def errorbar( 2476 x, y, yerr=None, xerr=None,
fmt='', ecolor=None, 2477 elinewidth=None, capsize=None,
barsabove=False, lolims=False, 2478 uplims=False,
xlolims=False, xuplims=False, errorevery=1, 2479
capthick=None, *, data=None, **kwargs):-> 2480 return
gca().errorbar( 2481 x, y, yerr=yerr, xerr=xerr, fmt=fmt,
ecolor=ecolor, 2482 elinewidth=elinewidth, capsize=capsize,
barsabove=barsabove, 2483 lolims=lolims, uplims=uplims,
xlolims=xlolims, 2484 xuplims=xuplims,
errorevery=errorevery, capthick=capthick, 2485 **({"data":
data} if data is not None else {}), **kwargs)
File ~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/matplotlib/__init__.py:1423,
in _preprocess_data.<locals>.inner(ax, data, *args, **kwargs) 1420
@functools.wraps(func) 1421 def inner(ax, *args, data=None,
**kwargs): 1422 if data is None:-> 1423 return func(ax,
*map(sanitize_sequence, args), **kwargs) 1425 bound =
new_sig.bind(ax, *args, **kwargs) 1426 auto_label =
(bound.arguments.get(label_namer) 1427 or
bound.kwargs.get(label_namer))
File ~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/matplotlib/axes/_axes.py:3587,
in Axes.errorbar(self, x, y, yerr, xerr, fmt, ecolor, elinewidth,
capsize, barsabove, lolims, uplims, xlolims, xuplims, errorevery,
capthick, **kwargs) 3584 res = np.zeros(err.shape, dtype=bool) #
Default in case of nan 3585 if np.any(np.less(err, -err, out=res,
where=(err == err))): 3586 # like err<0, but also works for
timedelta and nan.-> 3587 raise ValueError( 3588
f"'{dep_axis}err' must not contain negative values") 3589 # This is
like 3590 # elow, ehigh = np.broadcast_to(...) 3591 #
return dep - elow * ~lolims, dep + ehigh * ~uplims 3592 # except
that broadcast_to would strip units. 3593 low, high = dep +
np.row_stack([-(1 - lolims), 1 - uplims]) * err
ValueError: 'yerr' must not contain negative values
-------------------------
Any idea as to what the issue might be? I am running Python 3.8,
Matplotlib 3.6.0, and graph-tool 2.45
Apologies for the previous message for the wrong library to this list,
I am testing out a few libraries and hastily sent that message to the
wrong project.
I have python 3.8.13, igraph 0.10.1, with matplotlib 3.6.0, and when
running the sample scripts from the install page on the website, I am
receiving an error. The scripts can be found here:
https://igraph.org/python/tutorial/latest/install.html
I am referring to the following
>>> import matplotlib.pyplot as plt
>>> import igraph as ig
>>> fig, ax = plt.subplots()
>>> g = ig.Graph.Famous("petersen")
>>> ig.plot(g, target=ax)
>>> plt.show()
I receive the following errors at the ig.plot(g, target=ax) line:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [120], line 6
4 fig, ax = plt.subplots()
5 g = ig.Graph.Famous("petersen")
----> 6 ig.plot(g, target=ax)
8 plt.show()
File
~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/igraph/drawing/__init__.py:245,
in plot(obj, target, bbox, *args, **kwds)
243 return
244 else:
--> 245 plotter(
246 backend,
247 target,
248 palette=palette,
249 *args,
250 **kwds,
251 )
252 return target
254 # Cairo backend
File
~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/igraph/drawing/graph.py:558,
in __plot__(self, backend, context, *args, **kwds)
552 from igraph.drawing import DrawerDirectory
554 drawer = kwds.pop(
555 "drawer_factory",
556 DrawerDirectory.resolve(self, backend)(context),
557 )
--> 558 drawer.draw(self, *args, **kwds)
File
~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/igraph/drawing/matplotlib/graph.py:233,
in MatplotlibGraphDrawer.draw(self, graph, *args, **kwds)
231 drawer_method = vertex_drawer.draw
232 for vertex, visual_vertex, coords in vertex_coord_iter:
--> 233 drawer_method(visual_vertex, vertex, coords)
235 # Construct the iterator that we will use to draw the vertex labels
236 vs = graph.vs
File
~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/igraph/drawing/matplotlib/vertex.py:60,
in MatplotlibVertexDrawer.draw(self, visual_vertex, vertex, coords)
49 width = (
50 visual_vertex.width
51 if visual_vertex.width is not None
52 else visual_vertex.size
53 )
54 height = (
55 visual_vertex.height
56 if visual_vertex.height is not None
57 else visual_vertex.size
58 )
---> 60 stroke = visual_vertex.shape.draw_path(
61 ax,
62 coords[0],
63 coords[1],
64 width,
65 height,
66 facecolor=visual_vertex.color,
67 edgecolor=visual_vertex.frame_color,
68 linewidth=visual_vertex.frame_width,
69 zorder=visual_vertex.zorder,
70 )
71 ax.add_patch(stroke)
File
~/anaconda3/envs/rapids-2208/lib/python3.8/site-packages/igraph/drawing/shapes.py:168,
in CircleDrawer.draw_path(ctx, center_x, center_y, width, height, **kwargs)
166 return mpl.patches.Circle((center_x, center_y), width / 2,
**kwargs)
167 else:
--> 168 ctx.arc(center_x, center_y, width / 2, 0, 2 * pi)
AttributeError: 'AxesSubplot' object has no attribute 'arc'
---------------------------------------------
Not sure if its my python or package versions, or if its a configuration
issue, or possibly an issue with igraph or matplotlib. Any advice would be
most welcome