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

Skip to content

Commit 81e27d4

Browse files
authored
Merge pull request #17544 from timhoffm/plot-fillstyle-none
markerfacecolor should not override fillstyle='none' in plot()
2 parents 62bc037 + c4fa6eb commit 81e27d4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/matplotlib/lines.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,12 +936,11 @@ def get_markeredgewidth(self):
936936
return self._markeredgewidth
937937

938938
def _get_markerfacecolor(self, alt=False):
939+
if self.get_fillstyle() == 'none':
940+
return 'none'
939941
fc = self._markerfacecoloralt if alt else self._markerfacecolor
940942
if cbook._str_lower_equal(fc, 'auto'):
941-
if self.get_fillstyle() == 'none':
942-
return 'none'
943-
else:
944-
return self._color
943+
return self._color
945944
else:
946945
return fc
947946

lib/matplotlib/tests/test_lines.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ def test_marker_fill_styles():
183183
ax.set_xlim([-5, 155])
184184

185185

186+
def test_markerfacecolor_fillstyle():
187+
"""Test that markerfacecolor does not override fillstyle='none'."""
188+
l, = plt.plot([1, 3, 2], marker=MarkerStyle('o', fillstyle='none'),
189+
markerfacecolor='red')
190+
assert l.get_fillstyle() == 'none'
191+
assert l.get_markerfacecolor() == 'none'
192+
193+
186194
@image_comparison(['scaled_lines'], style='default')
187195
def test_lw_scaling():
188196
th = np.linspace(0, 32)

0 commit comments

Comments
 (0)