@@ -41,13 +41,13 @@ def check_for(texsystem):
41
41
return latex .returncode == 0
42
42
43
43
44
- def compare_figure (fname , savefig_kwargs = {}):
44
+ def compare_figure (fname , savefig_kwargs = {}, tol = 0 ):
45
45
actual = os .path .join (result_dir , fname )
46
46
plt .savefig (actual , ** savefig_kwargs )
47
47
48
48
expected = os .path .join (result_dir , "expected_%s" % fname )
49
49
shutil .copyfile (os .path .join (baseline_dir , fname ), expected )
50
- err = compare_images (expected , actual , tol = 0 )
50
+ err = compare_images (expected , actual , tol = tol )
51
51
if err :
52
52
raise ImageComparisonFailure (err )
53
53
@@ -88,7 +88,7 @@ def test_xelatex():
88
88
'pgf.rcfonts' : False }
89
89
mpl .rcParams .update (rc_xelatex )
90
90
create_figure ()
91
- compare_figure ('pgf_xelatex.pdf' )
91
+ compare_figure ('pgf_xelatex.pdf' , tol = 0 )
92
92
93
93
94
94
# test compiling a figure to pdf with pdflatex
@@ -104,7 +104,7 @@ def test_pdflatex():
104
104
'\\ usepackage[T1]{fontenc}' ]}
105
105
mpl .rcParams .update (rc_pdflatex )
106
106
create_figure ()
107
- compare_figure ('pgf_pdflatex.pdf' )
107
+ compare_figure ('pgf_pdflatex.pdf' , tol = 14 )
108
108
109
109
110
110
# test updating the rc parameters for each figure
@@ -129,11 +129,11 @@ def test_rcupdate():
129
129
'pgf.preamble' : ['\\ usepackage[utf8x]{inputenc}' ,
130
130
'\\ usepackage[T1]{fontenc}' ,
131
131
'\\ usepackage{sfmath}' ]})
132
-
132
+ tol = ( 4 , 13 )
133
133
for i , rc_set in enumerate (rc_sets ):
134
134
mpl .rcParams .update (rc_set )
135
135
create_figure ()
136
- compare_figure ('pgf_rcupdate%d.pdf' % (i + 1 ))
136
+ compare_figure ('pgf_rcupdate%d.pdf' % (i + 1 ), tol = tol [ i ] )
137
137
138
138
139
139
# test backend-side clipping, since large numbers are not supported by TeX
@@ -167,7 +167,7 @@ def test_mixedmode():
167
167
Y , X = np .ogrid [- 1 :1 :40j , - 1 :1 :40j ]
168
168
plt .figure ()
169
169
plt .pcolor (X ** 2 + Y ** 2 ).set_rasterized (True )
170
- compare_figure ('pgf_mixedmode.pdf' )
170
+ compare_figure ('pgf_mixedmode.pdf' , tol = 0 )
171
171
172
172
173
173
# test bbox_inches clipping
@@ -189,7 +189,8 @@ def test_bbox_inches():
189
189
plt .tight_layout ()
190
190
191
191
bbox = ax1 .get_window_extent ().transformed (fig .dpi_scale_trans .inverted ())
192
- 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 )
193
194
194
195
195
196
if __name__ == '__main__' :
0 commit comments