diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 736b1e77e1ac..96b9c4f11066 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -1515,7 +1515,7 @@ def _make_verts(self): length = distance else: length = distance + head_length - if not length: + if np.size(length) == 0: self.verts = np.empty([0, 2]) # display nothing if empty else: # start by drawing horizontal arrow, point at (0, 0) diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index d98998ef179a..98e45dbad9e0 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -999,3 +999,9 @@ def test_set_and_get_hatch_linewidth(fig_test, fig_ref): assert ax_ref.patches[0].get_hatch_linewidth() == lw assert ax_test.patches[0].get_hatch_linewidth() == lw + + +def test_empty_fancyarrow(): + fig, ax = plt.subplots() + arrow = ax.arrow([], [], [], []) + assert arrow is not None