Skip to content

Commit

Permalink
Merge pull request #1251 from jenshnielsen/pgf_dashes
Browse files Browse the repository at this point in the history
backend_pgf: custom dashstyles and compliance with other backends
  • Loading branch information
Peter Würtz committed Sep 18, 2012
2 parents 1485757 + 486d198 commit dd05f0a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/matplotlib/backends/backend_pgf.py
Expand Up @@ -497,18 +497,16 @@ def _print_pgf_path_styles(self, gc, rgbFace):
writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % gc.get_alpha())

# line style
dash_offset, dash_list = gc.get_dashes()
ls = gc.get_linestyle(None)
if ls == "solid":
writeln(self.fh, r"\pgfsetdash{}{0pt}")
elif ls == "dashed":
dashargs = (2.5 * lw, 2.5 * lw)
writeln(self.fh, r"\pgfsetdash{{%fpt}{%fpt}}{0pt}" % dashargs)
elif ls == "dashdot":
dashargs = (3 * lw, 3 * lw, 1 * lw, 3 * lw)
writeln(self.fh, r"\pgfsetdash{{%fpt}{%fpt}{%fpt}{%fpt}}{0pt}" % dashargs)
elif "dotted":
dashargs = (lw, 3 * lw)
writeln(self.fh, r"\pgfsetdash{{%fpt}{%fpt}}{0pt}" % dashargs)
elif (ls == "dashed" or ls == "dashdot" or ls == "dotted"):
dash_str = r"\pgfsetdash{"
for dash in dash_list:
dash_str += r"{%fpt}" % dash
dash_str += r"}{%fpt}" % dash_offset
writeln(self.fh, dash_str)

def _print_pgf_path(self, path, transform):
f = 1. / self.dpi
Expand Down

0 comments on commit dd05f0a

Please sign in to comment.