Skip to content

Commit 55c24d1

Browse files
committed
FIX: legend when edgecolor is face
1 parent 5fdadf5 commit 55c24d1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/matplotlib/legend_handler.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,11 @@ def get_first(prop_array):
747747
return prop_array[0]
748748
else:
749749
return None
750-
edgecolor = orig_handle.get_edgecolor()
750+
edgecolor = getattr(orig_handle, '_original_edgecolor',
751+
orig_handle.get_edgecolor())
752+
if edgecolor == 'face':
753+
# let get_edgecolor handle this:
754+
edgecolor = orig_handle.get_edgecolor()
751755
legend_handle.set_edgecolor(first_color(edgecolor))
752756
facecolor = getattr(orig_handle, '_original_facecolor',
753757
orig_handle.get_facecolor())

lib/matplotlib/tests/test_legend.py

+7
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,10 @@ def test_plot_multiple_label_incorrect_length_exception():
764764
label = ['high', 'low', 'medium']
765765
fig, ax = plt.subplots()
766766
ax.plot(x, y, label=label)
767+
768+
769+
def test_legend_face_edgecolor():
770+
fig, ax = plt.subplots()
771+
ax.fill_between([0, 1, 2], [1, 2, 3], [2, 3, 4],
772+
facecolor='r', edgecolor='face', label='Fill')
773+
ax.legend()

0 commit comments

Comments
 (0)