Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f24001a

Browse filesBrowse files
committed
FIX: do not try to interpolate empty paths
1 parent 4c43570 commit f24001a
Copy full SHA for f24001a

File tree

Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed

‎lib/matplotlib/path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/path.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def interpolated(self, steps):
681681
Path
682682
The interpolated path.
683683
"""
684-
if steps == 1:
684+
if steps == 1 or len(self) == 0:
685685
return self
686686

687687
if self.codes is not None and self.MOVETO in self.codes[1:]:

‎lib/matplotlib/tests/test_path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_path.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,3 +617,8 @@ def test_interpolated_moveto_closepoly():
617617

618618
np.testing.assert_allclose(result.vertices, expected_vertices)
619619
np.testing.assert_array_equal(result.codes, expected_codes)
620+
621+
622+
def test_interpolated_empty_path():
623+
path = Path(np.zeros((0, 2)))
624+
assert path.interpolated(42) is path

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.