diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index e0c2ddd21ec0..0af0e270c76b 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -306,9 +306,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) @@ -572,15 +572,16 @@ def get_linewidth(self): return self._linewidth def get_marker(self): return self._marker.get_marker() def get_markeredgecolor(self): - if (is_string_like(self._markeredgecolor) and - self._markeredgecolor == 'auto'): + mec = self._markeredgecolor + if (is_string_like(mec) and mec == 'auto'): if self._marker.get_marker() in ('.', ','): return self._color - if self._marker.is_filled(): + if self._marker.is_filled() and self.get_fillstyle() != 'none': return 'k' # Bad hard-wired default... else: return self._color - return self._markeredgecolor + else: + return mec def get_markeredgewidth(self): return self._markeredgewidth @@ -590,10 +591,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 diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index dff21414f597..66c54eca7230 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -101,7 +101,8 @@ 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') + _half_fillstyles = ('left' , 'right' , 'bottom' , 'top') # TODO: Is this ever used as a non-constant? _point_size_reduction = 0.5 @@ -244,11 +245,16 @@ def _set_mathtext_path(self): self._path = text self._snap = False + def _half_fill(self): + fs = self.get_fillstyle() + result = fs in self._half_fillstyles + return result + def _set_circle(self, reduction = 1.0): self._transform = Affine2D().scale(0.5 * reduction) self._snap_threshold = 3.0 fs = self.get_fillstyle() - if fs=='full': + if not self._half_fill(): self._path = Path.unit_circle() else: # build a right-half circle @@ -290,7 +296,7 @@ def _set_triangle(self, rot, skip): self._snap_threshold = 5.0 fs = self.get_fillstyle() - if fs=='full': + if not self._half_fill(): self._path = self._triangle_path else: mpaths = [self._triangle_path_u, @@ -329,7 +335,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 not self._half_fill(): self._path = Path.unit_rectangle() else: # build a bottom filled square out of two rectangles, one @@ -349,7 +355,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 not self._half_fill(): 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]]) @@ -374,7 +380,7 @@ def _set_pentagon(self): polypath = Path.unit_regular_polygon(5) fs = self.get_fillstyle() - if fs == 'full': + if not self._half_fill(): self._path = polypath else: verts = polypath.vertices @@ -404,7 +410,7 @@ def _set_star(self): fs = self.get_fillstyle() polypath = Path.unit_regular_star(5, innerCircle=0.381966) - if fs == 'full': + if not self._half_fill(): self._path = polypath else: verts = polypath.vertices @@ -433,7 +439,7 @@ def _set_hexagon1(self): fs = self.get_fillstyle() polypath = Path.unit_regular_polygon(6) - if fs == 'full': + if not self._half_fill(): self._path = polypath else: verts = polypath.vertices @@ -465,7 +471,7 @@ def _set_hexagon2(self): fs = self.get_fillstyle() polypath = Path.unit_regular_polygon(6) - if fs == 'full': + if not self._half_fill(): self._path = polypath else: verts = polypath.vertices @@ -497,7 +503,7 @@ def _set_octagon(self): fs = self.get_fillstyle() polypath = Path.unit_regular_polygon(8) - if fs == 'full': + if not self._half_fill(): self._transform.rotate_deg(22.5) self._path = polypath else: