Skip to content

Commit

Permalink
Merge pull request #3780 from pwuertz/fix_3779
Browse files Browse the repository at this point in the history
BUG : backend_pgf: \pgftext now requires \color inside argument (fix #3779) [backport to 1.4.x]
  • Loading branch information
tacaswell committed Nov 11, 2014
2 parents ebd921b + 46013de commit 1ae817a
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/matplotlib/backends/backend_pgf.py
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)


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
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 comments on commit 1ae817a

Please sign in to comment.