Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/api/next_api_changes/deprecations/20237-TH.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ QuadMesh signature
The ``QuadMesh`` signature ::

def __init__(meshWidth, meshHeight, coordinates,
antialiased=True, shading=False, **kwargs)
antialiased=True, shading='flat', **kwargs)

is deprecated and replaced by the new signature ::

def __init__(coordinates, *, antialiased=True, shading=False, **kwargs)
def __init__(coordinates, *, antialiased=True, shading='flat', **kwargs)

In particular:

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2002,15 +2002,15 @@ def __init__(self, *args, **kwargs):
# The following raises a TypeError iif the args don't match.
w, h, coords, antialiased, shading, kwargs = (
lambda meshWidth, meshHeight, coordinates, antialiased=True,
shading=False, **kwargs:
shading='flat', **kwargs:
(meshWidth, meshHeight, coordinates, antialiased, shading,
kwargs))(*args, **kwargs)
except TypeError as exc:
# New signature:
# If the following raises a TypeError (i.e. args don't match),
# just let it propagate.
coords, antialiased, shading, kwargs = (
lambda coordinates, antialiased=True, shading=False, **kwargs:
lambda coordinates, antialiased=True, shading='flat', **kwargs:
(coordinates, antialiased, shading, kwargs))(*args, **kwargs)
coords = np.asarray(coords, np.float64)
else: # The old signature matched.
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ def test_quadmesh_deprecated_signature(
qmesh = QuadMesh(coords, **kwargs)
qmesh.set_array(C)
ax.add_collection(qmesh)
assert qmesh._shading == 'flat'

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


@check_figures_equal(extensions=['png'])
Expand Down