Skip to content

Commit 94d73b7

Browse files
authored
Merge pull request #11748 from leejjoon/get_clip_path_check_nan
FIX: get_clip_path checks for nan
2 parents 2e61658 + 87a3413 commit 94d73b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backend_bases.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,12 @@ def get_clip_path(self):
837837
an affine transform to apply to the path before clipping.
838838
"""
839839
if self._clippath is not None:
840-
return self._clippath.get_transformed_path_and_affine()
840+
tpath, tr = self._clippath.get_transformed_path_and_affine()
841+
if np.all(np.isfinite(tpath.vertices)):
842+
return tpath, tr
843+
else:
844+
_log.warning("Ill-defined clip_path detected. Returning None.")
845+
return None, None
841846
return None, None
842847

843848
def get_dashes(self):

0 commit comments

Comments
 (0)