diff --git a/.travis.yml b/.travis.yml index 6e773768ce02..57e6a2789817 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_bbox_inches.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_bbox_inches.pdf index dcd7455e718b..dd9e2be23674 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_bbox_inches.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_bbox_inches.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_mixedmode.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_mixedmode.pdf index 8f510ea867d9..1a026b6a4aeb 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_mixedmode.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_mixedmode.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf index 3820562f9ee5..f8232f92a8ea 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf index 40e903070df1..0285ffd7ea04 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf index 21cd4af4a942..3e14fc83dcc3 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf index dbbacdb693ee..88932008aee7 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf differ diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py index 28be98c8f3cb..02534fa94b8e 100644 --- a/lib/matplotlib/tests/test_backend_pgf.py +++ b/lib/matplotlib/tests/test_backend_pgf.py @@ -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")) @@ -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(): @@ -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 @@ -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 @@ -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 @@ -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 @@ -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__':