Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ae817a

Browse files
committed
Merge pull request #3780 from pwuertz/fix_3779
BUG : backend_pgf: \pgftext now requires \color inside argument (fix #3779) [backport to 1.4.x]
2 parents ebd921b + 46013de commit 1ae817a

File tree

6 files changed

+4
-3
lines changed

6 files changed

+4
-3
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
638638
# prepare string for tex
639639
s = common_texification(s)
640640
prop_cmds = _font_properties_str(prop)
641-
s = r"{%s %s}" % (prop_cmds, s)
641+
s = r"%s %s" % (prop_cmds, s)
642642

643643

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

656657
f = 1.0 / self.figure.dpi
657658
text_args = []
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def create_figure():
8080
plt.plot([0.9], [0.5], "ro", markersize=3)
8181
plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)',
8282
ha='right', fontsize=20)
83-
plt.ylabel('sans-serif with math $\\frac{\\sqrt{x}}{y^2}$..',
84-
family='sans-serif')
83+
plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..',
84+
family='sans-serif', color='blue')
8585

8686

8787
# test compiling a figure to pdf with xelatex

0 commit comments

Comments
 (0)