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 45fa53d

Browse filesBrowse files
committed
image comparison decorator: add option to pass kwargs to savefig
1 parent f68ac89 commit 45fa53d
Copy full SHA for 45fa53d

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ def do_test():
142142
if self._remove_text:
143143
self.remove_text(figure)
144144

145-
figure.savefig(actual_fname)
145+
if self._savefig_kwarg:
146+
figure.savefig(actual_fname, **self._savefig_kwarg)
147+
else:
148+
figure.savefig(actual_fname)
146149

147150
err = compare_images(expected_fname, actual_fname,
148151
self._tol, in_decorator=True)
@@ -166,7 +169,7 @@ def do_test():
166169
yield (do_test,)
167170

168171
def image_comparison(baseline_images=None, extensions=None, tol=1e-3,
169-
freetype_version=None, remove_text=False):
172+
freetype_version=None, remove_text=False, savefig_kwarg=None):
170173
"""
171174
call signature::
172175
@@ -231,7 +234,8 @@ def compare_images_decorator(func):
231234
'_extensions': extensions,
232235
'_tol': tol,
233236
'_freetype_version': freetype_version,
234-
'_remove_text': remove_text})
237+
'_remove_text': remove_text,
238+
'_savefig_kwarg': savefig_kwarg})
235239

236240
return new_class
237241
return compare_images_decorator

0 commit comments

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