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 bd1d994

Browse filesBrowse files
committed
Ignore non-finite vetices when running count_contains
1 parent fc6a7ba commit bd1d994
Copy full SHA for bd1d994

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed

‎lib/matplotlib/transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/transforms.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,16 @@ 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 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)
654-
return (
655-
((self.min < vertices) & (vertices < self.max)).all(axis=1).sum())
655+
with np.errstate(invalid='ignore'):
656+
return (((self.min < vertices) &
657+
(vertices < self.max)).all(axis=1).sum())
656658

657659
def count_overlaps(self, bboxes):
658660
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.