adjustText
adjustText copied to clipboard
AdjustText in example code doesn't run
I tried to run the example code [21] in the documentation. I get the following errors and backtrace :
Traceback (most recent call last):
File "<ipython-input-52-996dde15e9bf>", line 1, in <module>
runfile('/home/hchoi/Documents/Gerdes_graph.py', wdir='/home/hchoi/Documents')
File "/usr/lib/python3/dist-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/usr/lib/python3/dist-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/home/hchoi/Documents/Gerdes_graph.py", line 55, in <module>
autoalign=False, only_move={'points':'x', 'text':'x', 'objects':'x'})
File "/home/hchoi/.local/lib/python3.6/site-packages/adjustText/__init__.py", line 509, in adjust_text
expand=expand_points)
File "/home/hchoi/.local/lib/python3.6/site-packages/adjustText/__init__.py", line 277, in repel_text_from_points
xy_in = get_points_inside_bbox(x, y, bbox)
File "/home/hchoi/.local/lib/python3.6/site-packages/adjustText/__init__.py", line 33, in get_points_inside_bbox
return np.asarray(np.nonzero(x_in & y_in)[0])
File "<__array_function__ internals>", line 6, in nonzero
File "/home/hchoi/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1908, in nonzero
return _wrapfunc(a, 'nonzero')
File "/home/hchoi/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 55, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "/home/hchoi/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 48, in _wrapit
result = wrap(result)
File "/home/hchoi/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 1787, in _array_wrap_
return self._constructor(result, **d).__finalize__(
File "/home/hchoi/.local/lib/python3.6/site-packages/pandas/core/series.py", line 314, in _init_
f"Length of passed values is {len(data)}, "
ValueError: Length of passed values is 1, index implies 72.
Tools and lib versions:
- matplotilb 3.3.1
- adjusttext 0.7.3
- numpy 1.19.1
- panda 1.1.0
Any idea ? :thinking:
Which example exactly doesn't work?
n°21 here : https://adjusttext.readthedocs.io/en/latest/Examples.html
Do other examples work for you?
I don't remember ever seeing this error, I'll try to have a look over the weekend or next week.
n°3 works (I didn't try all examples)
I have the same error using the code of examples n°20 and n°21:
ValueError: Length of passed values is 1, index implies 24.
- matplotlib 3.4.2
- adjusttext 0.7.3
- numpy 1.20.2
- panda 1.2.4
All examples work for me now, feel free to reopen if there is still an issue.