Skip to content

Refresh pgf baseline images. #5727

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 7 commits into from
Feb 16, 2016
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
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ addons:
- gdb
- mencoder
- dvipng
- pgf
- lmodern
- cm-super
- texlive-latex-base
- texlive-latex-extra
- texlive-fonts-recommended
- texlive-latex-recommended
- texlive-xetex
- graphviz
# - fonts-humor-sans
# sources:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 11 additions & 11 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def check_for(texsystem):
\\@@end
"""
try:
latex = subprocess.Popen(["xelatex", "-halt-on-error"],
latex = subprocess.Popen([texsystem, "-halt-on-error"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
stdout, stderr = latex.communicate(header.encode("utf8"))
Expand All @@ -41,16 +41,15 @@ def check_for(texsystem):
return latex.returncode == 0


def compare_figure(fname, savefig_kwargs={}):
def compare_figure(fname, savefig_kwargs={}, tol=0):
actual = os.path.join(result_dir, fname)
plt.savefig(actual, **savefig_kwargs)

expected = os.path.join(result_dir, "expected_%s" % fname)
shutil.copyfile(os.path.join(baseline_dir, fname), expected)
err = compare_images(expected, actual, tol=14)
err = compare_images(expected, actual, tol=tol)
if err:
raise ImageComparisonFailure('images not close: %s vs. '
'%s' % (actual, expected))
raise ImageComparisonFailure(err)


def create_figure():
Expand Down Expand Up @@ -89,7 +88,7 @@ def test_xelatex():
'pgf.rcfonts': False}
mpl.rcParams.update(rc_xelatex)
create_figure()
compare_figure('pgf_xelatex.pdf')
compare_figure('pgf_xelatex.pdf', tol=0)


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


# test updating the rc parameters for each figure
Expand All @@ -130,11 +129,11 @@ def test_rcupdate():
'pgf.preamble': ['\\usepackage[utf8x]{inputenc}',
'\\usepackage[T1]{fontenc}',
'\\usepackage{sfmath}']})

tol = (4, 0)
for i, rc_set in enumerate(rc_sets):
mpl.rcParams.update(rc_set)
create_figure()
compare_figure('pgf_rcupdate%d.pdf' % (i + 1))
compare_figure('pgf_rcupdate%d.pdf' % (i + 1), tol=tol[i])


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


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

bbox = ax1.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
compare_figure('pgf_bbox_inches.pdf', savefig_kwargs={'bbox_inches': bbox})
compare_figure('pgf_bbox_inches.pdf', savefig_kwargs={'bbox_inches': bbox},
tol=0)


if __name__ == '__main__':
Expand Down