Skip to content

Commit 97e5042

Browse files
committed
Fix DATA_PARAMETER_PLACEHOLDER interpolation for quiver&contour{,f}.
The docstring must be set (which we do using docstring.dedent_interpd) before the decoration with _preprocess_data(). While we're at it, replace kw by kwargs in quiver/barbs.
1 parent c757fe1 commit 97e5042

File tree

4 files changed

+245
-240
lines changed

4 files changed

+245
-240
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4966,43 +4966,39 @@ def arrow(self, x, y, dx, dy, **kwargs):
49664966
return a
49674967

49684968
@docstring.copy(mquiver.QuiverKey.__init__)
4969-
def quiverkey(self, Q, X, Y, U, label, **kw):
4970-
qk = mquiver.QuiverKey(Q, X, Y, U, label, **kw)
4969+
def quiverkey(self, Q, X, Y, U, label, **kwargs):
4970+
qk = mquiver.QuiverKey(Q, X, Y, U, label, **kwargs)
49714971
self.add_artist(qk)
49724972
return qk
49734973

49744974
# Handle units for x and y, if they've been passed
4975-
def _quiver_units(self, args, kw):
4975+
def _quiver_units(self, args, kwargs):
49764976
if len(args) > 3:
49774977
x, y = args[0:2]
4978-
x, y = self._process_unit_info([("x", x), ("y", y)], kw)
4978+
x, y = self._process_unit_info([("x", x), ("y", y)], kwargs)
49794979
return (x, y) + args[2:]
49804980
return args
49814981

49824982
# args can by a combination if X, Y, U, V, C and all should be replaced
49834983
@_preprocess_data()
4984-
def quiver(self, *args, **kw):
4984+
@docstring.dedent_interpd
4985+
def quiver(self, *args, **kwargs):
4986+
"""%(quiver_doc)s"""
49854987
# Make sure units are handled for x and y values
4986-
args = self._quiver_units(args, kw)
4987-
4988-
q = mquiver.Quiver(self, *args, **kw)
4989-
4988+
args = self._quiver_units(args, kwargs)
4989+
q = mquiver.Quiver(self, *args, **kwargs)
49904990
self.add_collection(q, autolim=True)
49914991
self._request_autoscale_view()
49924992
return q
4993-
quiver.__doc__ = mquiver.Quiver.quiver_doc
49944993

49954994
# args can be some combination of X, Y, U, V, C and all should be replaced
49964995
@_preprocess_data()
49974996
@docstring.dedent_interpd
4998-
def barbs(self, *args, **kw):
4999-
"""
5000-
%(barbs_doc)s
5001-
"""
4997+
def barbs(self, *args, **kwargs):
4998+
"""%(barbs_doc)s"""
50024999
# Make sure units are handled for x and y values
5003-
args = self._quiver_units(args, kw)
5004-
5005-
b = mquiver.Barbs(self, *args, **kw)
5000+
args = self._quiver_units(args, kwargs)
5001+
b = mquiver.Barbs(self, *args, **kwargs)
50065002
self.add_collection(b, autolim=True)
50075003
self._request_autoscale_view()
50085004
return b
@@ -6308,32 +6304,36 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
63086304
return ret
63096305

63106306
@_preprocess_data()
6307+
@docstring.dedent_interpd
63116308
def contour(self, *args, **kwargs):
6312-
kwargs['filled'] = False
6313-
contours = mcontour.QuadContourSet(self, *args, **kwargs)
6314-
self._request_autoscale_view()
6315-
return contours
6316-
contour.__doc__ = """
6309+
"""
63176310
Plot contour lines.
63186311
63196312
Call signature::
63206313
63216314
contour([X, Y,] Z, [levels], **kwargs)
6322-
""" + mcontour.QuadContourSet._contour_doc
6323-
6324-
@_preprocess_data()
6325-
def contourf(self, *args, **kwargs):
6326-
kwargs['filled'] = True
6315+
%(contour_doc)s
6316+
"""
6317+
kwargs['filled'] = False
63276318
contours = mcontour.QuadContourSet(self, *args, **kwargs)
63286319
self._request_autoscale_view()
63296320
return contours
6330-
contourf.__doc__ = """
6321+
6322+
@_preprocess_data()
6323+
@docstring.dedent_interpd
6324+
def contourf(self, *args, **kwargs):
6325+
"""
63316326
Plot filled contours.
63326327
63336328
Call signature::
63346329
63356330
contourf([X, Y,] Z, [levels], **kwargs)
6336-
""" + mcontour.QuadContourSet._contour_doc
6331+
%(contour_doc)s
6332+
"""
6333+
kwargs['filled'] = True
6334+
contours = mcontour.QuadContourSet(self, *args, **kwargs)
6335+
self._request_autoscale_view()
6336+
return contours
63376337

63386338
def clabel(self, CS, levels=None, **kwargs):
63396339
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy