Backport fix to pcolormesh snap argument
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
From 4039d6d10c679aa5c9a3268fbea663e05acf50d3 Mon Sep 17 00:00:00 2001
|
From 4039d6d10c679aa5c9a3268fbea663e05acf50d3 Mon Sep 17 00:00:00 2001
|
||||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
Date: Wed, 27 Sep 2017 19:35:59 -0400
|
Date: Wed, 27 Sep 2017 19:35:59 -0400
|
||||||
Subject: [PATCH 1/4] matplotlibrc path search fix
|
Subject: [PATCH 1/5] matplotlibrc path search fix
|
||||||
|
|
||||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0779db3fa70c58e88e048bec9b738ae02fccaead Mon Sep 17 00:00:00 2001
|
From 0779db3fa70c58e88e048bec9b738ae02fccaead Mon Sep 17 00:00:00 2001
|
||||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
Date: Fri, 14 Feb 2020 06:05:42 -0500
|
Date: Fri, 14 Feb 2020 06:05:42 -0500
|
||||||
Subject: [PATCH 2/4] Set FreeType version to 2.11.0 and update tolerances.
|
Subject: [PATCH 2/5] Set FreeType version to 2.11.0 and update tolerances.
|
||||||
|
|
||||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From af387ba8868b761273dc85b288196822ebba345c Mon Sep 17 00:00:00 2001
|
From af387ba8868b761273dc85b288196822ebba345c Mon Sep 17 00:00:00 2001
|
||||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
Date: Fri, 4 Jun 2021 02:32:31 -0400
|
Date: Fri, 4 Jun 2021 02:32:31 -0400
|
||||||
Subject: [PATCH 3/4] Slightly increase tolerance on rcupdate test.
|
Subject: [PATCH 3/5] Slightly increase tolerance on rcupdate test.
|
||||||
|
|
||||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From ce44fc4f778f3e7d781f5d812e86b10dff2ee1fc Mon Sep 17 00:00:00 2001
|
From ce44fc4f778f3e7d781f5d812e86b10dff2ee1fc Mon Sep 17 00:00:00 2001
|
||||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
Date: Tue, 24 Aug 2021 04:47:50 -0400
|
Date: Tue, 24 Aug 2021 04:47:50 -0400
|
||||||
Subject: [PATCH 4/4] Increase a few test tolerances on some arches.
|
Subject: [PATCH 4/5] Increase a few test tolerances on some arches.
|
||||||
|
|
||||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
From 4dabe86f04281c9ec307ecb2586f29f9c03b1257 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
|
Date: Tue, 5 Oct 2021 22:14:49 -0400
|
||||||
|
Subject: [PATCH 5/5] Fix snap argument to pcolormesh
|
||||||
|
|
||||||
|
If it's passed as a keyword argument, then it needs to be removed from
|
||||||
|
`kwargs`, or not passed again explicitly. Other handling of `snap` uses
|
||||||
|
`setdefault`, so do that here too.
|
||||||
|
|
||||||
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||||
|
---
|
||||||
|
lib/matplotlib/axes/_axes.py | 5 +++--
|
||||||
|
lib/matplotlib/tests/test_axes.py | 7 ++++---
|
||||||
|
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py
|
||||||
|
index 4eca2e6b0b..dcaadb8be3 100644
|
||||||
|
--- a/lib/matplotlib/axes/_axes.py
|
||||||
|
+++ b/lib/matplotlib/axes/_axes.py
|
||||||
|
@@ -6016,9 +6016,10 @@ default: :rc:`scatter.edgecolors`
|
||||||
|
# convert to one dimensional array
|
||||||
|
C = C.ravel()
|
||||||
|
|
||||||
|
- snap = kwargs.get('snap', rcParams['pcolormesh.snap'])
|
||||||
|
+ kwargs.setdefault('snap', rcParams['pcolormesh.snap'])
|
||||||
|
+
|
||||||
|
collection = mcoll.QuadMesh(
|
||||||
|
- coords, antialiased=antialiased, shading=shading, snap=snap,
|
||||||
|
+ coords, antialiased=antialiased, shading=shading,
|
||||||
|
array=C, cmap=cmap, norm=norm, alpha=alpha, **kwargs)
|
||||||
|
collection._scale_norm(norm, vmin, vmax)
|
||||||
|
self._pcolor_grid_deprecation_helper()
|
||||||
|
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
|
||||||
|
index a5e678d048..935cd11c1e 100644
|
||||||
|
--- a/lib/matplotlib/tests/test_axes.py
|
||||||
|
+++ b/lib/matplotlib/tests/test_axes.py
|
||||||
|
@@ -1250,22 +1250,23 @@ def test_pcolorflaterror():
|
||||||
|
ax.pcolormesh(x, y, Z, shading='flat')
|
||||||
|
|
||||||
|
|
||||||
|
+@pytest.mark.parametrize('snap', [False, True])
|
||||||
|
@check_figures_equal(extensions=["png"])
|
||||||
|
-def test_pcolorauto(fig_test, fig_ref):
|
||||||
|
+def test_pcolorauto(fig_test, fig_ref, snap):
|
||||||
|
ax = fig_test.subplots()
|
||||||
|
x = np.arange(0, 10)
|
||||||
|
y = np.arange(0, 4)
|
||||||
|
np.random.seed(19680801)
|
||||||
|
Z = np.random.randn(3, 9)
|
||||||
|
# this is the same as flat; note that auto is default
|
||||||
|
- ax.pcolormesh(x, y, Z)
|
||||||
|
+ ax.pcolormesh(x, y, Z, snap=snap)
|
||||||
|
|
||||||
|
ax = fig_ref.subplots()
|
||||||
|
# specify the centers
|
||||||
|
x2 = x[:-1] + np.diff(x) / 2
|
||||||
|
y2 = y[:-1] + np.diff(y) / 2
|
||||||
|
# this is same as nearest:
|
||||||
|
- ax.pcolormesh(x2, y2, Z)
|
||||||
|
+ ax.pcolormesh(x2, y2, Z, snap=snap)
|
||||||
|
|
||||||
|
|
||||||
|
@image_comparison(['canonical'])
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
||||||
@@ -58,6 +58,8 @@ Patch1002: 0002-Set-FreeType-version-to-%{ftver}-and-update-tolerances.patc
|
|||||||
# Work around for problems with texlive 2021 (#1965547)
|
# Work around for problems with texlive 2021 (#1965547)
|
||||||
Patch1003: 0003-Slightly-increase-tolerance-on-rcupdate-test.patch
|
Patch1003: 0003-Slightly-increase-tolerance-on-rcupdate-test.patch
|
||||||
Patch1004: 0004-Increase-a-few-test-tolerances-on-some-arches.patch
|
Patch1004: 0004-Increase-a-few-test-tolerances-on-some-arches.patch
|
||||||
|
# https://github.com/matplotlib/matplotlib/pull/21293
|
||||||
|
Patch1005: 0005-Fix-snap-argument-to-pcolormesh.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@@ -282,6 +284,7 @@ cp -p %{SOURCE1} mplsetup.cfg
|
|||||||
|
|
||||||
%patch1003 -p1
|
%patch1003 -p1
|
||||||
%patch1004 -p1
|
%patch1004 -p1
|
||||||
|
%patch1005 -p1
|
||||||
|
|
||||||
|
|
||||||
%generate_buildrequires
|
%generate_buildrequires
|
||||||
|
|||||||
Reference in New Issue
Block a user