Skip to content

FIX: cast return of contains_points to bool #6654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down