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

Skip to content

Commit 2a3707d

Browse files
committed
Markers with fillstyle 'none' should return False for is_filled()
1 parent 5e046f7 commit 2a3707d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/matplotlib/markers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ def _recache(self):
232232
self._snap_threshold = None
233233
self._joinstyle = 'round'
234234
self._capstyle = 'butt'
235-
self._filled = True
235+
# Initial guess: Assume the marker is filled unless the fillstyle is
236+
# set to 'none'. The marker function will override this for unfilled
237+
# markers.
238+
self._filled = self._fillstyle != 'none'
236239
self._marker_function()
237240

238241
def __bool__(self):

lib/matplotlib/tests/test_marker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
import pytest
88

99

10+
def test_marker_fillstyle():
11+
marker_style = markers.MarkerStyle(marker='o', fillstyle='none')
12+
assert marker_style.get_fillstyle() == 'none'
13+
assert not marker_style.is_filled()
14+
15+
1016
def test_markers_valid():
1117
marker_style = markers.MarkerStyle()
1218
mrk_array = np.array([[-0.5, 0],

0 commit comments

Comments
 (0)