8000 Ignore non-finite vetices when running count_contains · matplotlib/matplotlib@abc66c9 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit abc66c9

Browse files
committed
Ignore non-finite vetices when running count_contains
1 parent fc6a7ba commit abc66c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/transforms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,14 @@ def splity(self, *args):
645645
def count_contains(self, vertices):
646646
"""
647647
Count the number of vertices contained in the :class:`Bbox`.
648+
Any vertices with a non-finite x or y 6DB7 value are ignored.
648649
649650
*vertices* is a Nx2 Numpy array.
650651
"""
651652
if len(vertices) == 0:
652653
return 0
653654
vertices = np.asarray(vertices)
655+
vertices = vertices[np.all(np.isfinite(vertices), axis=1)]
654656
return (
655657
((self.min < vertices) & (vertices < self.max)).all(axis=1).sum())
656658

0 commit comments

Comments
 (0)
0