Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Several hatching improvements #7421

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 5 commits into from
Nov 14, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix hatching with no edges in PS backend.
Also, clean up some redundancies; 72 -> sidelen and the setpattern
operator simplifies setting the pattern.
  • Loading branch information
QuLogic committed Nov 9, 2016
commit f2853bd696c39c63fb2020ce4766173a5d7f6b9b
14 changes: 7 additions & 7 deletions 14 lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ def create_hatch(self, hatch):
%(linewidth)f setlinewidth
""" % locals())
self._pswriter.write(
self._convert_path(Path.hatch(hatch), Affine2D().scale(72.0),
self._convert_path(Path.hatch(hatch), Affine2D().scale(sidelen),
simplify=False))
self._pswriter.write("""\
stroke
stroke
} bind
>>
matrix
Expand Down Expand Up @@ -861,6 +861,7 @@ def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None):
stroke = stroke and mightstroke
fill = (fill and rgbFace is not None and
(len(rgbFace) <= 3 or rgbFace[3] != 0.0))
hatch = gc.get_hatch()

if mightstroke:
self.set_linewidth(gc.get_linewidth())
Expand All @@ -886,19 +887,18 @@ def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None):
write("\n")

if fill:
if stroke:
if stroke or hatch:
write("gsave\n")
self.set_color(store=0, *rgbFace[:3])
write("fill\n")
if stroke:
if stroke or hatch:
write("grestore\n")

hatch = gc.get_hatch()
if hatch:
hatch_name = self.create_hatch(hatch)
write("gsave\n")
write("[/Pattern [/DeviceRGB]] setcolorspace %f %f %f " % gc.get_hatch_color()[:3])
write("%s setcolor fill grestore\n" % hatch_name)
write("%f %f %f " % gc.get_hatch_color()[:3])
write("%s setpattern fill grestore\n" % hatch_name)

if stroke:
write("stroke\n")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.