diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 5088596a893f..e1daf35eed45 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -600,7 +600,10 @@ def get_extents(self, transform=None, **kwargs): # as can the ends of the curve xys.append(curve([0, *dzeros, 1])) xys = np.concatenate(xys) - return Bbox([xys.min(axis=0), xys.max(axis=0)]) + if len(xys): + return Bbox([xys.min(axis=0), xys.max(axis=0)]) + else: + return Bbox.null() def intersects_path(self, other, filled=True): """ diff --git a/lib/matplotlib/tests/test_path.py b/lib/matplotlib/tests/test_path.py index ebe2e1a46de7..2c4844b47f37 100644 --- a/lib/matplotlib/tests/test_path.py +++ b/lib/matplotlib/tests/test_path.py @@ -19,6 +19,8 @@ def test_empty_closed_path(): path = Path(np.zeros((0, 2)), closed=True) assert path.vertices.shape == (0, 2) assert path.codes is None + assert_array_equal(path.get_extents().extents, + transforms.Bbox.null().extents) def test_readonly_path():
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: