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
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 4 .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 22 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.