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 found the issue and it is with Matplotlib 3.6.0. Down grading to 3.5.3 solved the issues encountered, and the code in question runs as expected.
On Wed, Sep 21, 2022 at 4:57 PM Jos J josjuniormail@gmail.com wrote:
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.