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

Skip to content

Commit 0b741ee

Browse files
authored
Merge pull request #20332 from jeffreypaul15/mpl-20322
Quadmesh's default value of shading is now set to 'flat' instead of False
2 parents dd08ab0 + 95f4003 commit 0b741ee

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

doc/api/next_api_changes/deprecations/20237-TH.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ QuadMesh signature
33
The ``QuadMesh`` signature ::
44

55
def __init__(meshWidth, meshHeight, coordinates,
6-
antialiased=True, shading=False, **kwargs)
6+
antialiased=True, shading='flat', **kwargs)
77

88
is deprecated and replaced by the new signature ::
99

10-
def __init__(coordinates, *, antialiased=True, shading=False, **kwargs)
10+
def __init__(coordinates, *, antialiased=True, shading='flat', **kwargs)
1111

1212
In particular:
1313

lib/matplotlib/collections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,15 +2002,15 @@ def __init__(self, *args, **kwargs):
20022002
# The following raises a TypeError iif the args don't match.
20032003
w, h, coords, antialiased, shading, kwargs = (
20042004
lambda meshWidth, meshHeight, coordinates, antialiased=True,
2005-
shading=False, **kwargs:
2005+
shading='flat', **kwargs:
20062006
(meshWidth, meshHeight, coordinates, antialiased, shading,
20072007
kwargs))(*args, **kwargs)
20082008
except TypeError as exc:
20092009
# New signature:
20102010
# If the following raises a TypeError (i.e. args don't match),
20112011
# just let it propagate.
20122012
coords, antialiased, shading, kwargs = (
2013-
lambda coordinates, antialiased=True, shading=False, **kwargs:
2013+
lambda coordinates, antialiased=True, shading='flat', **kwargs:
20142014
(coordinates, antialiased, shading, kwargs))(*args, **kwargs)
20152015
coords = np.asarray(coords, np.float64)
20162016
else: # The old signature matched.

lib/matplotlib/tests/test_collections.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ def test_quadmesh_deprecated_signature(
743743
qmesh = QuadMesh(coords, **kwargs)
744744
qmesh.set_array(C)
745745
ax.add_collection(qmesh)
746+
assert qmesh._shading == 'flat'
746747

747748
ax = fig_ref.add_subplot()
748749
ax.set(xlim=(0, 5), ylim=(0, 4))
@@ -754,6 +755,7 @@ def test_quadmesh_deprecated_signature(
754755
**kwargs)
755756
qmesh.set_array(C.flatten() if flat_ref else C)
756757
ax.add_collection(qmesh)
758+
assert qmesh._shading == 'flat'
757759

758760

759761
@check_figures_equal(extensions=['png'])

0 commit comments

Comments
 (0)