Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a5f06f

Browse filesBrowse files
committed
Merge pull request #6008 from jenshnielsen/backport_pgf
Backport Refresh pgf baseline images. #5727
2 parents 04dce81 + 0187a78 commit 3a5f06f
Copy full SHA for 3a5f06f

File tree

Expand file treeCollapse file tree

8 files changed

+15
-11
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+15
-11
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ addons:
1414
- gdb
1515
- mencoder
1616
- dvipng
17+
- pgf
18+
- lmodern
19+
- cm-super
1720
- texlive-latex-base
1821
- texlive-latex-extra
1922
- texlive-fonts-recommended
2023
- texlive-latex-recommended
24+
- texlive-xetex
2125
- graphviz
2226
# - fonts-humor-sans
2327
# sources:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/test_backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pgf.py
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check_for(texsystem):
3131
\\@@end
3232
"""
3333
try:
34-
latex = subprocess.Popen(["xelatex", "-halt-on-error"],
34+
latex = subprocess.Popen([texsystem, "-halt-on-error"],
3535
stdin=subprocess.PIPE,
3636
stdout=subprocess.PIPE)
3737
stdout, stderr = latex.communicate(header.encode("utf8"))
@@ -41,16 +41,15 @@ def check_for(texsystem):
4141
return latex.returncode == 0
4242

4343

44-
def compare_figure(fname, savefig_kwargs={}):
44+
def compare_figure(fname, savefig_kwargs={}, tol=0):
4545
actual = os.path.join(result_dir, fname)
4646
plt.savefig(actual, **savefig_kwargs)
4747

4848
expected = os.path.join(result_dir, "expected_%s" % fname)
4949
shutil.copyfile(os.path.join(baseline_dir, fname), expected)
50-
err = compare_images(expected, actual, tol=14)
50+
err = compare_images(expected, actual, tol=tol)
5151
if err:
52-
raise ImageComparisonFailure('images not close: %s vs. '
53-
'%s' % (actual, expected))
52+
raise ImageComparisonFailure(err)
5453

5554

5655
def create_figure():
@@ -89,7 +88,7 @@ def test_xelatex():
8988
'pgf.rcfonts': False}
9089
mpl.rcParams.update(rc_xelatex)
9190
create_figure()
92-
compare_figure('pgf_xelatex.pdf')
91+
compare_figure('pgf_xelatex.pdf', tol=0)
9392

9493

9594
# test compiling a figure to pdf with pdflatex
@@ -105,7 +104,7 @@ def test_pdflatex():
105104
'\\usepackage[T1]{fontenc}']}
106105
mpl.rcParams.update(rc_pdflatex)
107106
create_figure()
108-
compare_figure('pgf_pdflatex.pdf')
107+
compare_figure('pgf_pdflatex.pdf', tol=0)
109108

110109

111110
# test updating the rc parameters for each figure
@@ -130,11 +129,11 @@ def test_rcupdate():
130129
'pgf.preamble': ['\\usepackage[utf8x]{inputenc}',
131130
'\\usepackage[T1]{fontenc}',
132131
'\\usepackage{sfmath}']})
133-
132+
tol = (4, 0)
134133
for i, rc_set in enumerate(rc_sets):
135134
mpl.rcParams.update(rc_set)
136135
create_figure()
137-
compare_figure('pgf_rcupdate%d.pdf' % (i + 1))
136+
compare_figure('pgf_rcupdate%d.pdf' % (i + 1), tol=tol[i])
138137

139138

140139
# test backend-side clipping, since large numbers are not supported by TeX
@@ -168,7 +167,7 @@ def test_mixedmode():
168167
Y, X = np.ogrid[-1:1:40j, -1:1:40j]
169168
plt.figure()
170169
plt.pcolor(X**2 + Y**2).set_rasterized(True)
171-
compare_figure('pgf_mixedmode.pdf')
170+
compare_figure('pgf_mixedmode.pdf', tol=0)
172171

173172

174173
# test bbox_inches clipping
@@ -190,7 +189,8 @@ def test_bbox_inches():
190189
plt.tight_layout()
191190

192191
bbox = ax1.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
193-
compare_figure('pgf_bbox_inches.pdf', savefig_kwargs={'bbox_inches': bbox})
192+
compare_figure('pgf_bbox_inches.pdf', savefig_kwargs={'bbox_inches': bbox},
193+
tol=0)
194194

195195

196196
if __name__ == '__main__':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.