Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f6df2e

Browse files
committed
FIX: empty list to reshape2d
1 parent 5d56c1c commit 3f6df2e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,8 @@ def _reshape_2D(X, name):
14161416
"""
14171417
# Iterate over columns for ndarrays, over rows otherwise.
14181418
X = np.atleast_1d(X.T if isinstance(X, np.ndarray) else np.asarray(X))
1419+
if len(X) == 0:
1420+
return [[]]
14191421
if X.ndim == 1 and not isinstance(X[0], collections.abc.Iterable):
14201422
# 1D array of scalars: directly return it.
14211423
return [X]

0 commit comments

Comments
 (0)