Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f74ea7 commit ec18892Copy full SHA for ec18892
1 file changed
lib/matplotlib/cbook/__init__.py
@@ -1397,8 +1397,11 @@ def _reshape_2D(X, name):
1397
# 1D array of scalars: directly return it.
1398
return [X]
1399
elif X.ndim in [1, 2]:
1400
- # 2D array, or 1D array of iterables: flatten them first.
1401
- return [np.reshape(x, -1) for x in X]
+ if hasattr(X[0], '__len__'):
+ # 2D array, or 1D array of iterables: flatten them first.
1402
+ return [np.reshape(x, -1) for x in X]
1403
+ else:
1404
+ return [X]
1405
else:
1406
raise ValueError("{} must have 2 or fewer dimensions".format(name))
1407
0 commit comments