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 d9a2379

Browse filesBrowse files
anntzerMeeseeksDev[bot]
authored andcommitted
Backport PR #13652: Fix empty FancyArrow crash
1 parent 45929b6 commit d9a2379
Copy full SHA for d9a2379

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+7
-1
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
12691269
else:
12701270
length = distance + head_length
12711271
if not length:
1272-
verts = [] # display nothing if empty
1272+
verts = np.empty([0, 2]) # display nothing if empty
12731273
else:
12741274
# start by drawing horizontal arrow, point at (0,0)
12751275
hw, hl, hs, lw = head_width, head_length, overhang, width

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@ def test_arrow_simple():
379379
head_length=theta / 10)
380380

381381

382+
def test_arrow_empty():
383+
_, ax = plt.subplots()
384+
# Create an empty FancyArrow
385+
ax.arrow(0, 0, 0, 0, head_length=0)
386+
387+
382388
def test_annotate_default_arrow():
383389
# Check that we can make an annotation arrow with only default properties.
384390
fig, ax = plt.subplots()

0 commit comments

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