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

Skip to content

Commit ccb3966

Browse files
committed
FIX: Support RGB(A) color arrays for pcolor
This updates the masked handling to support the 3-dimensional RGB(A) case if someone inputs those directly rather than mapped colors.
1 parent 2cf02fd commit ccb3966

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/collections.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,11 @@ def __init__(self, coordinates, **kwargs):
22522252
mask[0:-1, 1:] | mask[1:, 0:-1])
22532253
# Take account of the array data too
22542254
C = kwargs.get("array", np.empty(coordinates.shape[:2]))
2255-
mask |= np.ma.getmaskarray(C)
2255+
if C.ndim == 3:
2256+
# RGB(A) case
2257+
mask |= np.any(np.ma.getmaskarray(C), axis=-1)
2258+
else:
2259+
mask |= np.ma.getmaskarray(C)
22562260

22572261
unmask = ~mask
22582262
self._valid_polys = unmask.ravel()

0 commit comments

Comments
 (0)