Permalink
Browse files

Merge pull request #598 from efiring/fix_marker_edges

lines.py: fix bugs in marker alpha and edge colors
  • Loading branch information...
2 parents 62073cf + 050c0b1 commit 23cdfaa13881b1edac1f2a7301c854352b595e63 @mdboom mdboom committed Nov 28, 2011
Showing with 15 additions and 11 deletions.
  1. +15 −11 lib/matplotlib/lines.py
View
@@ -508,8 +508,15 @@ def draw(self, renderer):
if self._marker:
gc = renderer.new_gc()
self._set_gc_clip(gc)
- gc.set_foreground(self.get_markeredgecolor())
- gc.set_linewidth(self._markeredgewidth)
+ rgbFace = self._get_rgb_face()
+ rgbFaceAlt = self._get_rgb_face(alt=True)
+ edgecolor = self.get_markeredgecolor()
+ if is_string_like(edgecolor) and edgecolor.lower() == 'none':
+ gc.set_linewidth(0)
+ gc.set_foreground(rgbFace)
+ else:
+ gc.set_foreground(edgecolor)
+ gc.set_linewidth(self._markeredgewidth)
gc.set_alpha(self._alpha)
marker = self._marker
tpath, affine = self._transformed_path.get_transformed_points_and_affine()
@@ -539,18 +546,16 @@ def draw(self, renderer):
w = renderer.points_to_pixels(self._markersize)
if marker.get_marker() != ',': # Don't scale for pixels
marker_trans = marker_trans.scale(w)
- rgbFace = self._get_rgb_face()
renderer.draw_markers(
gc, marker_path, marker_trans, subsampled, affine.frozen(),
rgbFace)
alt_marker_path = marker.get_alt_path()
if alt_marker_path:
alt_marker_trans = marker.get_alt_transform()
alt_marker_trans = alt_marker_trans.scale(w)
- rgbFace = self._get_rgb_face(alt=True)
renderer.draw_markers(
gc, alt_marker_path, alt_marker_trans, subsampled,
- affine.frozen(), rgbFace)
+ affine.frozen(), rgbFaceAlt)
gc.restore()
@@ -567,16 +572,15 @@ def get_marker(self): return self._marker.get_marker()
def get_markeredgecolor(self):
if (is_string_like(self._markeredgecolor) and
- self._markeredgecolor == 'auto'):
+ self._markeredgecolor == 'auto'):
+ if self._marker.get_marker() in ('.', ','):
+ return self._color
if self._marker.is_filled():
- return 'k'
+ return 'k' # Bad hard-wired default...
else:
return self._color
- else:
- return self._markeredgecolor
-
-
return self._markeredgecolor
+
def get_markeredgewidth(self): return self._markeredgewidth
def _get_markerfacecolor(self, alt=False):

0 comments on commit 23cdfaa

Please sign in to comment.