Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 025b98e

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #24669: Doc: clarify preferred image comparison test settings
1 parent 4f66a7a commit 025b98e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/devel/testing.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ tests it::
109109
import matplotlib.pyplot as plt
110110

111111
@image_comparison(baseline_images=['line_dashes'], remove_text=True,
112-
extensions=['png'])
112+
extensions=['png'], style='mpl20')
113113
def test_line_dashes():
114114
fig, ax = plt.subplots()
115115
ax.plot(range(10), linestyle=(0, (3, 3)), lw=5)
@@ -130,6 +130,12 @@ images on the figures using two different methods (the tested method and the
130130
baseline method). The decorator will arrange for setting up the figures and
131131
then collect the drawn results and compare them.
132132

133+
It is preferred that new tests use ``style='mpl20'`` as this leads to smaller
134+
figures and reflects the newer look of default Matplotlib plots. Also, if the
135+
texts (labels, tick labels, etc) are not really part of what is tested, use
136+
``remove_text=True`` as this will lead to smaller figures and reduce possible
137+
issues with font mismatch on different platforms.
138+
133139
See the documentation of `~matplotlib.testing.decorators.image_comparison` and
134140
`~matplotlib.testing.decorators.check_figures_equal` for additional information
135141
about their use.

0 commit comments

Comments
 (0)