From 9b6f9f84301490c05780c713119018f478ad643c Mon Sep 17 00:00:00 2001 From: Jae-Joon Lee Date: Mon, 23 Jul 2018 19:18:22 +0900 Subject: [PATCH 1/2] gc.get_clip_path checks for nan --- lib/matplotlib/backend_bases.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 2d225a3123ce..023c2855e689 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -837,7 +837,12 @@ def get_clip_path(self): an affine transform to apply to the path before clipping. """ if self._clippath is not None: - return self._clippath.get_transformed_path_and_affine() + tpath, tr = self._clippath.get_transformed_path_and_affine() + if np.all(np.isfinite(tpath.vertices)): + return tpath, tr + else: + warnings.warn("Ill-defined clip_path detected. Returning None.") + return None, None return None, None def get_dashes(self): From 87a3413bc6720f558db38f7aaf47d2e63e007cbd Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Wed, 23 Sep 2020 15:52:52 -0700 Subject: [PATCH 2/2] Update lib/matplotlib/backend_bases.py change warning.warn to _log.warning --- lib/matplotlib/backend_bases.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 023c2855e689..8b0bc695d213 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -841,7 +841,7 @@ def get_clip_path(self): if np.all(np.isfinite(tpath.vertices)): return tpath, tr else: - warnings.warn("Ill-defined clip_path detected. Returning None.") + _log.warning("Ill-defined clip_path detected. Returning None.") return None, None return None, None