diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 2e0d86456167..67e340be2b5f 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -510,7 +510,7 @@ def contains_points(self, points, transform=None, radius=0.0): if transform is not None: transform = transform.frozen() result = _path.points_in_path(points, radius, self, transform) - return result + return result.astype('bool') def contains_path(self, path, transform=None): """ diff --git a/lib/matplotlib/tests/test_path.py b/lib/matplotlib/tests/test_path.py index 6543137c0e1f..a5508f7d522e 100644 --- a/lib/matplotlib/tests/test_path.py +++ b/lib/matplotlib/tests/test_path.py @@ -28,8 +28,9 @@ def test_point_in_path(): path = Path(verts2, closed=True) points = [(0.5, 0.5), (1.5, 0.5)] - - assert np.all(path.contains_points(points) == [True, False]) + ret = path.contains_points(points) + assert ret.dtype == 'bool' + assert np.all(ret == [True, False]) def test_contains_points_negative_radius():