From 2ab206fcbd946ba48481111f491b690db873b583 Mon Sep 17 00:00:00 2001 From: John McCullough Date: Mon, 3 Sep 2012 15:06:02 -0700 Subject: [PATCH 1/2] Hatch linewidth for pdf and ps backends. --- lib/matplotlib/backends/backend_pdf.py | 2 +- lib/matplotlib/backends/backend_ps.py | 3 ++- lib/matplotlib/rcsetup.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index 06f9b1d30156..c287a419d274 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -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 diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index d604028c554c..95f4c63c93fa 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -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 @@ -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), diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index bebe143b16b7..e3098fa2a109 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -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 From e9345dcce1e7450285cdc07b8177dc2adb495709 Mon Sep 17 00:00:00 2001 From: John McCullough Date: Wed, 5 Sep 2012 23:11:09 -0700 Subject: [PATCH 2/2] Some light text for matplotlibrc.template. --- matplotlibrc.template | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matplotlibrc.template b/matplotlibrc.template index c3991592af46..8515e89f3c3f 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -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