Skip to content

Commit

Permalink
Unify ps stroking logic, fixes ps part of issue matplotlib#621
Browse files Browse the repository at this point in the history
  • Loading branch information
jkseppan committed Dec 29, 2011
1 parent 3b38e6e commit 129750f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2011-12-29 ps and pdf markers are now stroked only if the line width
is nonzero for consistency with agg, fixes issue #621. - JKS

2011-10-25 added support for \operatorname to mathtext,
including the ability to insert spaces, such as
$\operatorname{arg\,max}$ - PI
Expand Down
10 changes: 7 additions & 3 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,10 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None)

if rgbFace:
ps_cmd.extend(['gsave', ps_color, 'fill', 'grestore'])
if gc.shouldstroke():
ps_cmd.append('stroke')

ps_cmd.extend(['stroke', 'grestore', '} bind def'])
ps_cmd.extend(['grestore', '} bind def'])

for vertices, code in path.iter_segments(trans, simplify=False):
if len(vertices):
Expand Down Expand Up @@ -855,8 +857,7 @@ def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None):
write = self._pswriter.write
if debugPS and command:
write("% "+command+"\n")
mightstroke = (gc.get_linewidth() > 0.0 and
(len(gc.get_rgb()) <= 3 or gc.get_rgb()[3] != 0.0))
mightstroke = gc.shouldstroke()
stroke = stroke and mightstroke
fill = (fill and rgbFace is not None and
(len(rgbFace) <= 3 or rgbFace[3] != 0.0))
Expand Down Expand Up @@ -917,6 +918,9 @@ def get_joinstyle(self):
'round':1,
'bevel':2}[GraphicsContextBase.get_joinstyle(self)]

def shouldstroke(self):
return (self.get_linewidth() > 0.0 and
(len(self.get_rgb()) <= 3 or self.get_rgb()[3] != 0.0))

def new_figure_manager(num, *args, **kwargs):
FigureClass = kwargs.pop('FigureClass', Figure)
Expand Down

0 comments on commit 129750f

Please sign in to comment.