8000 backend_pgf: \pgftext now requires \color inside argument (fix #3779) [backport to 1.4.x] by pwuertz · Pull Request #3780 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

backend_pgf: \pgftext now requires \color inside argument (fix #3779) [backport to 1.4.x] #3780

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

Merged
merged 2 commits into from
Nov 11, 2014
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
3 changes: 2 additions & 1 deletion lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
# prepare string for tex
s = common_texification(s)
prop_cmds = _font_properties_str(prop)
s = r"{%s %s}" % (prop_cmds, s)
s = r"%s %s" % (prop_cmds, s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know almost nothing about pgf, but dropping the {} smells funny....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was redundant because in the end s is embedded into \pgftext[%s]{%s}.



writeln(self.fh, r"\begin{pgfscope}")
Expand All @@ -652,6 +652,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
writeln(self.fh, r"\definecolor{textcolor}{rgb}{%f,%f,%f}" % rgb)
writeln(self.fh, r"\pgfsetstrokecolor{textcolor}")
writeln(self.fh, r"\pgfsetfillcolor{textcolor}")
s = r"\color{textcolor}" + s

f = 1.0 / self.figure.dpi
text_args = []
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def create_figure():
plt.plot([0.9], [0.5], "ro", markersize=3)
plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)',
ha='right', fontsize=20)
plt.ylabel('sans-serif with math $\\frac{\\sqrt{x}}{y^2}$..',
family='sans-serif')
plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..',
family='sans-serif', color='blue')


# test compiling a figure to pdf with xelatex
Expand Down
0