From 9459e42449e42f7090c2319e45319845f33ec850 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Wed, 16 Aug 2023 00:23:15 +0530 Subject: [PATCH 01/21] Update testing.rst Added an example for figure comparison/ --- doc/devel/testing.rst | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 06296f5dc701..d221958e5275 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -107,7 +107,7 @@ tests it:: from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt - + @image_comparison(baseline_images=['line_dashes'], remove_text=True, extensions=['png'], style='mpl20') def test_line_dashes(): @@ -122,19 +122,29 @@ case :file:`lib/matplotlib/tests/baseline_images/test_lines`). Put this new file under source code revision control (with ``git add``). When rerunning the tests, they should now pass. +It is preferred that new tests use ``style='mpl20'`` as this leads to smaller +figures and reflects the newer look of default Matplotlib plots. Also, if the +texts (labels, tick labels, etc) are not really part of what is tested, use +``remove_text=True`` as this will lead to smaller figures and reduce possible +issues with font mismatch on different platforms. + Baseline images take a lot of space in the Matplotlib repository. An alternative approach for image comparison tests is to use the `~matplotlib.testing.decorators.check_figures_equal` decorator, which should be used to decorate a function taking two `.Figure` parameters and draws the same images on the figures using two different methods (the tested method and the baseline method). The decorator will arrange for setting up the figures and -then collect the drawn results and compare them. - -It is preferred that new tests use ``style='mpl20'`` as this leads to smaller -figures and reflects the newer look of default Matplotlib plots. Also, if the -texts (labels, tick labels, etc) are not really part of what is tested, use -``remove_text=True`` as this will lead to smaller figures and reduce possible -issues with font mismatch on different platforms. +then collect the drawn results and compare them. For example, this test draws +the same circle on the figures with two different methods:: + + from matplotlib.testing.decorators import check_figures_equal + import matplotlib.pyplot as plt + + @check_figures_equal(extensions=['png'], tol=100) + def test_plot(fig_test, fig_ref): + red_circle = plt.Circle((0, 0), 0.2, color='r', clip_on=False) + fig_ref.add_artist(red_circle) + fig_ref.subplots().plot([0,1,2], [3,4,5], color='red') See the documentation of `~matplotlib.testing.decorators.image_comparison` and `~matplotlib.testing.decorators.check_figures_equal` for additional information From 1c28caafdb3b5120ccff6ea10e2c900bf95e3bb2 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:43:47 +0530 Subject: [PATCH 02/21] Update testing.rst --- doc/devel/testing.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index d221958e5275..93acce6de318 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -146,6 +146,11 @@ the same circle on the figures with two different methods:: fig_ref.add_artist(red_circle) fig_ref.subplots().plot([0,1,2], [3,4,5], color='red') +In this example, one of the argument is ``tol=100`` where tol is used for the +determining the tolerance (a color value difference, where 255 is the maximal +difference). The test fails if the average pixel difference is greater than +this value. + See the documentation of `~matplotlib.testing.decorators.image_comparison` and `~matplotlib.testing.decorators.check_figures_equal` for additional information about their use. From 0ff2125a75d304ad1a84f3cc453dac505e0f5456 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Wed, 16 Aug 2023 23:34:01 +0530 Subject: [PATCH 03/21] Update doc/devel/testing.rst Fixed trailing spaces Co-authored-by: Kyle Sunden --- doc/devel/testing.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 93acce6de318..9704dacab13c 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -107,7 +107,6 @@ tests it:: from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt - @image_comparison(baseline_images=['line_dashes'], remove_text=True, extensions=['png'], style='mpl20') def test_line_dashes(): From a182f3f3be159932fe94b9891e3a2c5ac90ebd2c Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:05:41 +0530 Subject: [PATCH 04/21] Update testing.rst Made changes to add fig_test and made the documentation more cohesive. --- doc/devel/testing.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 9704dacab13c..1ecc6294a69a 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -133,17 +133,25 @@ An alternative approach for image comparison tests is to use the used to decorate a function taking two `.Figure` parameters and draws the same images on the figures using two different methods (the tested method and the baseline method). The decorator will arrange for setting up the figures and -then collect the drawn results and compare them. For example, this test draws -the same circle on the figures with two different methods:: +then collect the drawn results and compare them. + +For example, this test compares two different methods to draw the same +circle, that are plotting a circle using circle patch (matplotlib.patches.Circle()) +vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal - import matplotlib.pyplot as plt + import matplotlib.pyplot as plt + import numpy as np + import pytest @check_figures_equal(extensions=['png'], tol=100) def test_plot(fig_test, fig_ref): - red_circle = plt.Circle((0, 0), 0.2, color='r', clip_on=False) - fig_ref.add_artist(red_circle) - fig_ref.subplots().plot([0,1,2], [3,4,5], color='red') + red_circle_ref = plt.Circle((0, 0), 0.2, color='r', clip_on=False) + fig_ref.add_artist(red_circle_ref) + theta = np.linspace( 0 , 2 * np.pi , 150 ) + radius = 0.4 + fig_test.plot(radius * np.cos( theta ), radius * np.sin( theta ), + color='r') In this example, one of the argument is ``tol=100`` where tol is used for the determining the tolerance (a color value difference, where 255 is the maximal From f1726fc5264a07eee4d992dffd3218af09db2fce Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:09:39 +0530 Subject: [PATCH 05/21] Update testing.rst Removed import pytest and added the trailing space. --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 1ecc6294a69a..532a54a1137b 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -107,6 +107,7 @@ tests it:: from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt + @image_comparison(baseline_images=['line_dashes'], remove_text=True, extensions=['png'], style='mpl20') def test_line_dashes(): @@ -142,7 +143,6 @@ vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal import matplotlib.pyplot as plt import numpy as np - import pytest @check_figures_equal(extensions=['png'], tol=100) def test_plot(fig_test, fig_ref): From 4edea20066a9ceec3d6a49d4be6cfa9f077cba51 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:10:21 +0530 Subject: [PATCH 06/21] Update testing.rst --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 532a54a1137b..0d2fb01f7bc6 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -107,7 +107,7 @@ tests it:: from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt - + @image_comparison(baseline_images=['line_dashes'], remove_text=True, extensions=['png'], style='mpl20') def test_line_dashes(): From 302aa4e47f804418235409333c433b6e90af3204 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Fri, 18 Aug 2023 00:41:55 +0530 Subject: [PATCH 07/21] Update doc/devel/testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 0d2fb01f7bc6..936ecda8ba13 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -137,7 +137,7 @@ baseline method). The decorator will arrange for setting up the figures and then collect the drawn results and compare them. For example, this test compares two different methods to draw the same -circle, that are plotting a circle using circle patch (matplotlib.patches.Circle()) +circle: plotting a circle using circle patch (matplotlib.patches.Circle()) vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal From bb3a00e2429eaaddfa645b764164778609d2ec1e Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Fri, 18 Aug 2023 00:50:05 +0530 Subject: [PATCH 08/21] Update testing.rst Tried to remove most of the trailing spaces and changed the name of the test. --- doc/devel/testing.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 936ecda8ba13..e2ce58025d14 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -134,10 +134,10 @@ An alternative approach for image comparison tests is to use the used to decorate a function taking two `.Figure` parameters and draws the same images on the figures using two different methods (the tested method and the baseline method). The decorator will arrange for setting up the figures and -then collect the drawn results and compare them. +then collect the drawn results and compare them. -For example, this test compares two different methods to draw the same -circle: plotting a circle using circle patch (matplotlib.patches.Circle()) +For example, this test compares two different methods to draw the same +circle: plotting a circle using circle patch (matplotlib.patches.Circle()) vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal @@ -145,17 +145,17 @@ vs plotting the circle using the parametric equation of a circle:: import numpy as np @check_figures_equal(extensions=['png'], tol=100) - def test_plot(fig_test, fig_ref): + def test_parametric_circle_plot(fig_test, fig_ref): red_circle_ref = plt.Circle((0, 0), 0.2, color='r', clip_on=False) fig_ref.add_artist(red_circle_ref) theta = np.linspace( 0 , 2 * np.pi , 150 ) radius = 0.4 fig_test.plot(radius * np.cos( theta ), radius * np.sin( theta ), - color='r') + color='r') -In this example, one of the argument is ``tol=100`` where tol is used for the -determining the tolerance (a color value difference, where 255 is the maximal -difference). The test fails if the average pixel difference is greater than +In this example, one of the argument is ``tol=100`` where tol is used for the +determining the tolerance (a color value difference, where 255 is the maximal +difference). The test fails if the average pixel difference is greater than this value. See the documentation of `~matplotlib.testing.decorators.image_comparison` and From 6d2e74fe15ff9a2d0942ed9421bf264c12fbd8b5 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:04:07 +0530 Subject: [PATCH 09/21] Resolving pre-commit-hook changes --- doc/devel/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index e2ce58025d14..c4c7304002d4 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -107,7 +107,7 @@ tests it:: from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt - + @image_comparison(baseline_images=['line_dashes'], remove_text=True, extensions=['png'], style='mpl20') def test_line_dashes(): @@ -143,14 +143,14 @@ vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal import matplotlib.pyplot as plt import numpy as np - + @check_figures_equal(extensions=['png'], tol=100) def test_parametric_circle_plot(fig_test, fig_ref): red_circle_ref = plt.Circle((0, 0), 0.2, color='r', clip_on=False) fig_ref.add_artist(red_circle_ref) theta = np.linspace( 0 , 2 * np.pi , 150 ) radius = 0.4 - fig_test.plot(radius * np.cos( theta ), radius * np.sin( theta ), + fig_test.plot( radius * np.cos( theta ), radius * np.sin( theta ), color='r') In this example, one of the argument is ``tol=100`` where tol is used for the From 412f8c322554dbbbbabcc95ed5cdfc5658063687 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:07:13 +0530 Subject: [PATCH 10/21] Update doc/devel/testing.rst Removing spaces around parantheses as suggested Co-authored-by: Elliott Sales de Andrade --- doc/devel/testing.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index c4c7304002d4..ce1384afd5e2 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -148,10 +148,9 @@ vs plotting the circle using the parametric equation of a circle:: def test_parametric_circle_plot(fig_test, fig_ref): red_circle_ref = plt.Circle((0, 0), 0.2, color='r', clip_on=False) fig_ref.add_artist(red_circle_ref) - theta = np.linspace( 0 , 2 * np.pi , 150 ) + theta = np.linspace(0, 2 * np.pi, 150) radius = 0.4 - fig_test.plot( radius * np.cos( theta ), radius * np.sin( theta ), - color='r') + fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r') In this example, one of the argument is ``tol=100`` where tol is used for the determining the tolerance (a color value difference, where 255 is the maximal From 132b13dc3734bbed7404d3e4a2c73a98cc88d828 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:12:59 +0530 Subject: [PATCH 11/21] Resolving pre-commit-hook changes --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index c4c7304002d4..2bc38395babc 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -137,7 +137,7 @@ baseline method). The decorator will arrange for setting up the figures and then collect the drawn results and compare them. For example, this test compares two different methods to draw the same -circle: plotting a circle using circle patch (matplotlib.patches.Circle()) +circle: plotting a circle using circle patch (``matplotlib.patches.Circle()``) vs plotting the circle using the parametric equation of a circle:: from matplotlib.testing.decorators import check_figures_equal From 744e6d49aff3b69c924da7baa544cff3ecf31549 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:32:32 +0530 Subject: [PATCH 12/21] Resolving pre-commit-hook changes --- doc/devel/testing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index fc93c196f81b..72859f0c93a4 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -137,8 +137,8 @@ baseline method). The decorator will arrange for setting up the figures and then collect the drawn results and compare them. For example, this test compares two different methods to draw the same -circle: plotting a circle using circle patch (``matplotlib.patches.Circle()``) -vs plotting the circle using the parametric equation of a circle:: +`circle`: plotting a `circle` using circle patch (`matplotlib.patches.Circle()`) +vs plotting the `circle` using the parametric equation of a `circle`:: from matplotlib.testing.decorators import check_figures_equal import matplotlib.pyplot as plt From 461494ea2271318263921daa0312a9dbbe7fd7cd Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:40:17 +0530 Subject: [PATCH 13/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 72859f0c93a4..630c7ccadd9a 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -137,7 +137,7 @@ baseline method). The decorator will arrange for setting up the figures and then collect the drawn results and compare them. For example, this test compares two different methods to draw the same -`circle`: plotting a `circle` using circle patch (`matplotlib.patches.Circle()`) +circle: plotting a circle using a `~.Circle` patch vs plotting the `circle` using the parametric equation of a `circle`:: from matplotlib.testing.decorators import check_figures_equal From 4add791b90a68fc16be6d015c5107440920e31c4 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:40:22 +0530 Subject: [PATCH 14/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 630c7ccadd9a..e4fcaa999a2c 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -146,7 +146,8 @@ vs plotting the `circle` using the parametric equation of a `circle`:: @check_figures_equal(extensions=['png'], tol=100) def test_parametric_circle_plot(fig_test, fig_ref): - red_circle_ref = plt.Circle((0, 0), 0.2, color='r', clip_on=False) + import matplotlib.patches as mpatches + red_circle_ref = mpatches.Circle((0, 0), 0.2, color='r', clip_on=False) fig_ref.add_artist(red_circle_ref) theta = np.linspace(0, 2 * np.pi, 150) radius = 0.4 From 02203f1305973e6ed810f00c1a3528073de44178 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:40:29 +0530 Subject: [PATCH 15/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index e4fcaa999a2c..14032ec5b177 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -153,7 +153,7 @@ vs plotting the `circle` using the parametric equation of a `circle`:: radius = 0.4 fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r') -In this example, one of the argument is ``tol=100`` where tol is used for the +In this example, one of the arguments is ``tol=100`` where tol is used for the determining the tolerance (a color value difference, where 255 is the maximal difference). The test fails if the average pixel difference is greater than this value. From 4d7c58ffa74a30da92192ae3aa956938168dea1c Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 23:06:47 +0530 Subject: [PATCH 16/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 14032ec5b177..a5dbda7b2536 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -137,7 +137,7 @@ baseline method). The decorator will arrange for setting up the figures and then collect the drawn results and compare them. For example, this test compares two different methods to draw the same -circle: plotting a circle using a `~.Circle` patch +circle: plotting a circle using a `matplotlib.patches.Circle` patch vs plotting the `circle` using the parametric equation of a `circle`:: from matplotlib.testing.decorators import check_figures_equal From 323fd7b2788870cbca091af66d48a45b907808ff Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 23:06:54 +0530 Subject: [PATCH 17/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index a5dbda7b2536..70edb05f6213 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -138,7 +138,7 @@ then collect the drawn results and compare them. For example, this test compares two different methods to draw the same circle: plotting a circle using a `matplotlib.patches.Circle` patch -vs plotting the `circle` using the parametric equation of a `circle`:: +vs plotting the circle using the parametric equation of a circle :: from matplotlib.testing.decorators import check_figures_equal import matplotlib.pyplot as plt From 8e51433f60c8ff5272d46a192e86b4a884881d1f Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Tue, 22 Aug 2023 23:07:40 +0530 Subject: [PATCH 18/21] Update testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 70edb05f6213..6ac30738b7f0 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -153,9 +153,7 @@ vs plotting the circle using the parametric equation of a circle :: radius = 0.4 fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r') -In this example, one of the arguments is ``tol=100`` where tol is used for the -determining the tolerance (a color value difference, where 255 is the maximal -difference). The test fails if the average pixel difference is greater than +Both comparison decorators have a tolerance argument ``tol=100`` that is used to specify the tolerance for difference in color value between the two images, where 255 is the maximal difference. The test fails if the average pixel difference is greater than this value. See the documentation of `~matplotlib.testing.decorators.image_comparison` and From 30251e308a1c0b5ef81b57394b2a0f5205c0a93b Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:23:50 +0530 Subject: [PATCH 19/21] Update doc/devel/testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 6ac30738b7f0..26e295ce6f6a 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -153,7 +153,7 @@ vs plotting the circle using the parametric equation of a circle :: radius = 0.4 fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r') -Both comparison decorators have a tolerance argument ``tol=100`` that is used to specify the tolerance for difference in color value between the two images, where 255 is the maximal difference. The test fails if the average pixel difference is greater than +Both comparison decorators have a tolerance argument ``tol`` that is used to specify the tolerance for difference in color value between the two images, where 255 is the maximal difference. The test fails if the average pixel difference is greater than this value. See the documentation of `~matplotlib.testing.decorators.image_comparison` and From 3d74be94a0920b3100939cca6bf100a9c38a1fc3 Mon Sep 17 00:00:00 2001 From: Kritika Verma <95202116+SunSummoner@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:25:21 +0530 Subject: [PATCH 20/21] Update doc/devel/testing.rst Co-authored-by: hannah --- doc/devel/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 26e295ce6f6a..d17a17d89111 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -141,12 +141,12 @@ circle: plotting a circle using a `matplotlib.patches.Circle` patch vs plotting the circle using the parametric equation of a circle :: from matplotlib.testing.decorators import check_figures_equal + import matplotib.patches as mpatches import matplotlib.pyplot as plt import numpy as np @check_figures_equal(extensions=['png'], tol=100) def test_parametric_circle_plot(fig_test, fig_ref): - import matplotlib.patches as mpatches red_circle_ref = mpatches.Circle((0, 0), 0.2, color='r', clip_on=False) fig_ref.add_artist(red_circle_ref) theta = np.linspace(0, 2 * np.pi, 150) From c386d8e5c93aac9e04c21eb35cfc376a53477ba3 Mon Sep 17 00:00:00 2001 From: hannah Date: Sun, 27 Aug 2023 20:39:15 -0400 Subject: [PATCH 21/21] accidental new line --- doc/devel/testing.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index d17a17d89111..3b84e4aa859c 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -153,8 +153,7 @@ vs plotting the circle using the parametric equation of a circle :: radius = 0.4 fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r') -Both comparison decorators have a tolerance argument ``tol`` that is used to specify the tolerance for difference in color value between the two images, where 255 is the maximal difference. The test fails if the average pixel difference is greater than -this value. +Both comparison decorators have a tolerance argument ``tol`` that is used to specify the tolerance for difference in color value between the two images, where 255 is the maximal difference. The test fails if the average pixel difference is greater than this value. See the documentation of `~matplotlib.testing.decorators.image_comparison` and `~matplotlib.testing.decorators.check_figures_equal` for additional information