Skip to content

allow fillstyle 'none' option #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 31, 2011
Next Next commit
first commit to allow fillstyle none
  • Loading branch information
Craig M committed Aug 31, 2011
commit 213459eabb44b4b84bfafc51a9c6964f1e0494cf
13 changes: 7 additions & 6 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ def get_fillstyle(self):
def set_fillstyle(self, fs):
"""
Set the marker fill style; 'full' means fill the whole marker.
The other options are for half filled markers
'none' means no filling; other options are for half-filled markers.

ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top']
ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top' | 'none']
"""
self._marker.set_fillstyle(fs)

Expand Down Expand Up @@ -585,10 +585,11 @@ def _get_markerfacecolor(self, alt=False):
else:
fc = self._markerfacecolor

if (fc is None or (is_string_like(fc) and fc.lower()=='none') ):
return fc
elif (is_string_like(fc) and fc.lower() == 'auto'):
return self._color
if (is_string_like(fc) and fc.lower() == 'auto'):
if self.get_fillstyle() == 'none':
return 'none'
else:
return self._color
else:
return fc

Expand Down
17 changes: 8 additions & 9 deletions lib/matplotlib/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ class MarkerStyle:
filled_markers = (
'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd')

fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top')
fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top', 'none')

# TODO: Is this ever used as a non-constant?
_point_size_reduction = 0.5

def __init__(self, marker=None, fillstyle='full'):
self._fillstyle = fillstyle
self.set_marker(marker)
self.set_fillstyle(fillstyle)

Expand Down Expand Up @@ -329,7 +328,7 @@ def _set_square(self):
self._transform = Affine2D().translate(-0.5, -0.5)
self._snap_threshold = 2.0
fs = self.get_fillstyle()
if fs=='full':
if fs == 'full' or fs == 'none':
self._path = Path.unit_rectangle()
else:
# build a bottom filled square out of two rectangles, one
Expand All @@ -349,7 +348,7 @@ def _set_diamond(self):
self._transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45)
self._snap_threshold = 5.0
fs = self.get_fillstyle()
if fs=='full':
if fs == 'full' or fs == 'none':
self._path = Path.unit_rectangle()
else:
self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]])
Expand All @@ -374,7 +373,7 @@ def _set_pentagon(self):
polypath = Path.unit_regular_polygon(5)
fs = self.get_fillstyle()

if fs == 'full':
if fs == 'full' or fs == 'none':
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -404,7 +403,7 @@ def _set_star(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_star(5, innerCircle=0.381966)

if fs == 'full':
if fs == 'full' or fs == 'none':
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -433,7 +432,7 @@ def _set_hexagon1(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(6)

if fs == 'full':
if fs == 'full' or fs == 'none':
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -465,7 +464,7 @@ def _set_hexagon2(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(6)

if fs == 'full':
if fs == 'full' or fs == 'none':
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -497,7 +496,7 @@ def _set_octagon(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(8)

if fs == 'full':
if fs == 'full' or fs == 'none':
self._transform.rotate_deg(22.5)
self._path = polypath
else:
Expand Down