Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def set_color(self, c):

def _set_hatchcolor(self, color):
color = mpl._val_or_rc(color, 'hatch.color')
if color == 'edge':
if cbook._str_equal(color, 'edge'):
self._hatch_color = 'edge'
else:
self._hatch_color = colors.to_rgba(color, self._alpha)
Expand All @@ -439,8 +439,6 @@ def set_hatchcolor(self, color):
----------
color : :mpltype:`color` or 'edge' or None
"""
if cbook._str_equal(color, 'edge'):
color = 'edge'
self._original_hatchcolor = color
self._set_hatchcolor(color)

Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@ def test_patch_hatchcolor_inherit_logic():
rect.set_edgecolor('green')
assert mcolors.same_color(rect.get_hatchcolor(), 'purple')

# Smoke test for setting with numpy array
rect.set_hatchcolor(np.ones(3))


def test_patch_hatchcolor_fallback_logic():
# Test for when hatchcolor parameter is passed
Expand Down
Loading