Skip to content

Commit 86f9f9c

Browse files
efiringtacaswell
authored andcommitted
Merge pull request matplotlib#3613 from demotu/master
Fix problem with legend if data has NaN's [backport to 1.4.x]
1 parent 5be59ab commit 86f9f9c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/matplotlib/transforms.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,11 @@ def count_contains(self, vertices):
648648
return 0
649649
vertices = np.asarray(vertices)
650650
x0, y0, x1, y1 = self._get_extents()
651-
dx0 = np.sign(vertices[:, 0] - x0)
652-
dy0 = np.sign(vertices[:, 1] - y0)
653-
dx1 = np.sign(vertices[:, 0] - x1)
654-
dy1 = np.sign(vertices[:, 1] - y1)
651+
with np.errstate(invalid='ignore'):
652+
dx0 = np.sign(vertices[:, 0] - x0)
653+
dy0 = np.sign(vertices[:, 1] - y0)
654+
dx1 = np.sign(vertices[:, 0] - x1)
655+
dy1 = np.sign(vertices[:, 1] - y1)
655656
inside = ((abs(dx0 + dx1) + abs(dy0 + dy1)) == 0)
656657
return np.sum(inside)
657658

0 commit comments

Comments
 (0)