diff --git a/lib/matplotlib/legend_handler.py b/lib/matplotlib/legend_handler.py index 45fb759d7b23..c9357ef0fe2c 100644 --- a/lib/matplotlib/legend_handler.py +++ b/lib/matplotlib/legend_handler.py @@ -747,8 +747,9 @@ def get_first(prop_array): return prop_array[0] else: return None - edgecolor = getattr(orig_handle, '_original_edgecolor', - orig_handle.get_edgecolor()) + edgecolor = orig_handle.get_edgecolor() + if edgecolor.size == 0: + edgecolor = None legend_handle.set_edgecolor(first_color(edgecolor)) facecolor = getattr(orig_handle, '_original_facecolor', orig_handle.get_facecolor()) diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index ff263e86e845..0e645934205e 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -764,3 +764,10 @@ def test_plot_multiple_label_incorrect_length_exception(): label = ['high', 'low', 'medium'] fig, ax = plt.subplots() ax.plot(x, y, label=label) + + +def test_legend_face_edgecolor(): + fig, ax = plt.subplots() + ax.fill_between([0, 1, 2], [1, 2, 3], [2, 3, 4], + facecolor='r', edgecolor='face', label='Fill') + ax.legend()