Skip to content

Hatch linewidth for pdf and ps backends (#235). #1200

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def writeHatches(self):
0, 0, sidelen, sidelen, Op.rectangle,
Op.fill)

self.output(0.1, Op.setlinewidth)
self.output(rcParams['hatch.linewidth'], Op.setlinewidth)

# TODO: We could make this dpi-dependent, but that would be
# an API change
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def create_hatch(self, hatch):
if hatch in self._hatches:
return self._hatches[hatch]
name = 'H%d' % len(self._hatches)
hatchwidth = rcParams['hatch.linewidth']
self._pswriter.write("""\
<< /PatternType 1
/PaintType 2
Expand All @@ -305,7 +306,7 @@ def create_hatch(self, hatch):

/PaintProc {
pop
0 setlinewidth
%(hatchwidth)f setlinewidth
""" % locals())
self._pswriter.write(
self._convert_path(Path.hatch(hatch), Affine2D().scale(72.0),
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ def __call__(self, s):
'patch.facecolor' : ['b', validate_color], # blue
'patch.antialiased' : [True, validate_bool], # antialised (no jaggies)

# hatch props
'hatch.linewidth' : [0.1, validate_float], # Hatch line width in points


# font props
'font.family' : ['sans-serif', str], # used by text object
Expand Down
8 changes: 8 additions & 0 deletions matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ backend : %(backend)s
#patch.edgecolor : black
#patch.antialiased : True # render patches in antialised (no jaggies)


### HATCHES
# Hatches are marks used to fill patterns within an artist.
# See
# http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Patch.set_hatch
# information on hatch properties
#hatch.linewidth : 0.1 # line width in points

### FONT
#
# font properties used by text.Text. See
Expand Down