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

Skip to content

Commit a0aac5a

Browse files
committed
Allow object arrays in cbook._combine_masks.
This function accepts almost anything list-like, so we really do want conversion to object arrays if the input is ragged. For example, this might occur for `scatter()` if passed different types of `colors`, like in the `test_scatter_marker` test.
1 parent b8b1733 commit a0aac5a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,12 @@ def _combine_masks(*args):
989989
else:
990990
if isinstance(x, np.ma.MaskedArray) and x.ndim > 1:
991991
raise ValueError("Masked arrays must be 1-D")
992-
x = np.asanyarray(x)
992+
try:
993+
x = np.asanyarray(x)
994+
except (np.VisibleDeprecationWarning, ValueError):
995+
# NumPy 1.19 raises a warning about ragged arrays, but we want
996+
# to accept basically anything here.
997+
x = np.asanyarray(x, dtype=object)
993998
if x.ndim == 1:
994999
x = safe_masked_invalid(x)
9951000
seqlist[i] = True

0 commit comments

Comments
 (0)