Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b6f9f8

Browse files
leejjoonjklymak
authored andcommitted
gc.get_clip_path checks for nan
1 parent 571a787 commit 9b6f9f8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 1 deletion
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+
warnings.warn("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)