MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_unmasked_polys

Method _get_unmasked_polys

lib/matplotlib/collections.py:2637–2654  ·  view source on GitHub ↗

Get the unmasked regions using the coordinates and array

(self)

Source from the content-addressed store, hash-verified

2635 self._set_unmasked_verts()
2636
2637 def _get_unmasked_polys(self):
2638 """Get the unmasked regions using the coordinates and array"""
2639 # mask(X) | mask(Y)
2640 mask = np.any(np.ma.getmaskarray(self._coordinates), axis=-1)
2641
2642 # We want the shape of the polygon, which is the corner of each X/Y array
2643 mask = (mask[0:-1, 0:-1] | mask[1:, 1:] | mask[0:-1, 1:] | mask[1:, 0:-1])
2644 arr = self.get_array()
2645 if arr is not None:
2646 arr = np.ma.getmaskarray(arr)
2647 if arr.ndim == 3:
2648 # RGB(A) case
2649 mask |= np.any(arr, axis=-1)
2650 elif arr.ndim == 2:
2651 mask |= arr
2652 else:
2653 mask |= arr.reshape(self._coordinates[:-1, :-1, :].shape[:2])
2654 return ~mask
2655
2656 def _set_unmasked_verts(self):
2657 X = self._coordinates[..., 0]

Callers 4

_set_unmasked_vertsMethod · 0.95
get_edgecolorMethod · 0.95
get_facecolorMethod · 0.95
set_arrayMethod · 0.95

Calls 1

get_arrayMethod · 0.80

Tested by

no test coverage detected