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 55c24d1

Browse filesBrowse files
committed
FIX: legend when edgecolor is face
1 parent 5fdadf5 commit 55c24d1
Copy full SHA for 55c24d1

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+12
-1
lines changed

‎lib/matplotlib/legend_handler.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend_handler.py
+5-1Lines changed: 5 additions & 1 deletion
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

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_legend.py
+7Lines changed: 7 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.