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

Skip to content

Commit 588b748

Browse files
authored
Merge pull request #6654 from tacaswell/mnt_points_contain_return_bool
FIX: cast return of `contains_points` to bool
2 parents 66eb81f + 4819a2c commit 588b748

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/matplotlib/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def contains_points(self, points, transform=None, radius=0.0):
510510
if transform is not None:
511511
transform = transform.frozen()
512512
result = _path.points_in_path(points, radius, self, transform)
513-
return result
513+
return result.astype('bool')
514514

515515
def contains_path(self, path, transform=None):
516516
"""

lib/matplotlib/tests/test_path.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def test_point_in_path():
2828

2929
path = Path(verts2, closed=True)
3030
points = [(0.5, 0.5), (1.5, 0.5)]
31-
32-
assert np.all(path.contains_points(points) == [True, False])
31+
ret = path.contains_points(points)
32+
assert ret.dtype == 'bool'
33+
assert np.all(ret == [True, False])
3334

3435

3536
def test_contains_points_negative_radius():

0 commit comments

Comments
 (0)