Skip to content
Merged
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/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ def get_hatch_color(self):

def set_hatch_color(self, hatch_color):
"""Set the hatch color."""
self._hatch_color = hatch_color
self._hatch_color = colors.to_rgba(hatch_color)

def get_hatch_linewidth(self):
"""Get the hatch linewidth."""
Expand Down
11 changes: 11 additions & 0 deletions lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ def draw_path(self, gc, path, transform, rgbFace=None):
r"\pgfsys@defobject{currentpattern}"
r"{\pgfqpoint{0in}{0in}}{\pgfqpoint{1in}{1in}}{")
_writeln(self.fh, r"\begin{pgfscope}")

# hatch linewidth and color
lw = gc.get_hatch_linewidth() * mpl_pt_to_in * latex_in_to_pt
hatch_rgba = gc.get_hatch_color()
_writeln(self.fh, r"\pgfsetlinewidth{%fpt}" % lw)
_writeln(self.fh,
r"\definecolor{currenthatch}{rgb}{%f,%f,%f}"
% hatch_rgba[:3])
_writeln(self.fh, r"\pgfsetstrokecolor{currenthatch}")
_writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % hatch_rgba[3])

_writeln(self.fh,
r"\pgfpathrectangle"
r"{\pgfqpoint{0in}{0in}}{\pgfqpoint{1in}{1in}}")
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def test_rcupdate():
{'font.family': 'monospace',
'font.size': 10,
'figure.subplot.left': .1,
'hatch.color': 'orange',
'hatch.linewidth': 2,
'lines.markersize': 20,
'pgf.rcfonts': False,
'pgf.texsystem': 'pdflatex',
Expand Down
Loading