Skip to content
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

backend_pgf. Enable custom dashstyles in the pgf backend #1251

Merged
merged 1 commit into from Sep 18, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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