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

Skip to content

Commit 7433f66

Browse files
committed
Make function signatures more explicit
1 parent 4257416 commit 7433f66

File tree

4 files changed

+27
-43
lines changed

4 files changed

+27
-43
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11471147

11481148
def rc(group, **kwargs):
11491149
"""
1150-
Set the current rc params. Group is the grouping for the rc, e.g.,
1150+
Set the current rc params. *group* is the grouping for the rc, e.g.,
11511151
for ``lines.linewidth`` the group is ``lines``, for
11521152
``axes.facecolor``, the group is ``axes``, and so on. Group may
11531153
also be a list or tuple of group names, e.g., (*xtick*, *ytick*).

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
471471
return t
472472

473473
@docstring.dedent_interpd
474-
def annotate(self, *args, **kwargs):
475-
a = mtext.Annotation(*args, **kwargs)
474+
def annotate(self, text, xy, *args, **kwargs):
475+
a = mtext.Annotation(text, xy, *args, **kwargs)
476476
a.set_transform(mtransforms.IdentityTransform())
477477
if 'clip_on' in kwargs:
478478
a.set_clip_path(self.patch)
@@ -4668,8 +4668,8 @@ def arrow(self, x, y, dx, dy, **kwargs):
46684668
self.add_artist(a)
46694669
return a
46704670

4671-
def quiverkey(self, *args, **kw):
4672-
qk = mquiver.QuiverKey(*args, **kw)
4671+
def quiverkey(self, Q, X, Y, U, label, **kw):
4672+
qk = mquiver.QuiverKey(Q, X, Y, U, label, **kw)
46734673
self.add_artist(qk)
46744674
return qk
46754675
quiverkey.__doc__ = mquiver.QuiverKey.quiverkey_doc

lib/matplotlib/figure.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,18 +1939,14 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
19391939
self.stale = True
19401940
return cb
19411941

1942-
def subplots_adjust(self, *args, **kwargs):
1942+
def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
1943+
wspace=None, hspace=None):
19431944
"""
1944-
Call signature::
1945-
1946-
subplots_adjust(left=None, bottom=None, right=None, top=None,
1947-
wspace=None, hspace=None)
1948-
19491945
Update the :class:`SubplotParams` with *kwargs* (defaulting to rc when
19501946
*None*) and update the subplot locations.
19511947
19521948
"""
1953-
self.subplotpars.update(*args, **kwargs)
1949+
self.subplotpars.update(left, bottom, right, top, wspace, hspace)
19541950
for ax in self.axes:
19551951
if not isinstance(ax, SubplotBase):
19561952
# Check if sharing a subplots axis

lib/matplotlib/pyplot.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ def pause(interval):
294294

295295

296296
@docstring.copy_dedent(matplotlib.rc)
297-
def rc(*args, **kwargs):
298-
matplotlib.rc(*args, **kwargs)
297+
def rc(group, **kwargs):
298+
matplotlib.rc(group, **kwargs)
299299

300300

301301
@docstring.copy_dedent(matplotlib.rc_context)
@@ -344,8 +344,8 @@ def sci(im):
344344
## Any Artist ##
345345
# (getp is simply imported)
346346
@docstring.copy(_setp)
347-
def setp(*args, **kwargs):
348-
return _setp(*args, **kwargs)
347+
def setp(obj, *args, **kwargs):
348+
return _setp(obj, *args, **kwargs)
349349

350350

351351
def xkcd(scale=1, length=100, randomness=2):
@@ -735,13 +735,13 @@ def waitforbuttonpress(*args, **kwargs):
735735
# Putting things in figures
736736

737737
@docstring.copy_dedent(Figure.text)
738-
def figtext(*args, **kwargs):
739-
return gcf().text(*args, **kwargs)
738+
def figtext(x, y, s, *args, **kwargs):
739+
return gcf().text(x, y, s, *args, **kwargs)
740740

741741

742742
@docstring.copy_dedent(Figure.suptitle)
743-
def suptitle(*args, **kwargs):
744-
return gcf().suptitle(*args, **kwargs)
743+
def suptitle(t, **kwargs):
744+
return gcf().suptitle(t, **kwargs)
745745

746746

747747
@docstring.copy_dedent(Figure.figimage)
@@ -1289,15 +1289,11 @@ def twiny(ax=None):
12891289
return ax1
12901290

12911291

1292-
def subplots_adjust(*args, **kwargs):
1292+
def subplots_adjust(left=None, bottom=None, right=None, top=None,
1293+
wspace=None, hspace=None):
12931294
"""
12941295
Tune the subplot layout.
12951296
1296-
call signature::
1297-
1298-
subplots_adjust(left=None, bottom=None, right=None, top=None,
1299-
wspace=None, hspace=None)
1300-
13011297
The parameter meanings (and suggested defaults) are::
13021298
13031299
left = 0.125 # the left side of the subplots of the figure
@@ -1312,7 +1308,7 @@ def subplots_adjust(*args, **kwargs):
13121308
The actual defaults are controlled by the rc file
13131309
"""
13141310
fig = gcf()
1315-
fig.subplots_adjust(*args, **kwargs)
1311+
fig.subplots_adjust(left, bottom, right, top, wspace, hspace)
13161312

13171313

13181314
def subplot_tool(targetfig=None):
@@ -1597,14 +1593,10 @@ def ylim(*args, **kwargs):
15971593

15981594

15991595
@docstring.dedent_interpd
1600-
def xscale(*args, **kwargs):
1596+
def xscale(scale, **kwargs):
16011597
"""
16021598
Set the scaling of the x-axis.
16031599
1604-
Call signature::
1605-
1606-
xscale(scale, **kwargs)
1607-
16081600
Parameters
16091601
----------
16101602
scale : [%(scale)s]
@@ -1621,18 +1613,14 @@ def xscale(*args, **kwargs):
16211613
16221614
%(scale_docs)s
16231615
"""
1624-
gca().set_xscale(*args, **kwargs)
1616+
gca().set_xscale(scale, **kwargs)
16251617

16261618

16271619
@docstring.dedent_interpd
1628-
def yscale(*args, **kwargs):
1620+
def yscale(scale, **kwargs):
16291621
"""
16301622
Set the scaling of the y-axis.
16311623
1632-
Call signature::
1633-
1634-
yscale(scale, **kwargs)
1635-
16361624
Parameters
16371625
----------
16381626
scale : [%(scale)s]
@@ -1649,7 +1637,7 @@ def yscale(*args, **kwargs):
16491637
16501638
%(scale_docs)s
16511639
"""
1652-
gca().set_yscale(*args, **kwargs)
1640+
gca().set_yscale(scale, **kwargs)
16531641

16541642

16551643
def xticks(*args, **kwargs):
@@ -2316,13 +2304,13 @@ def set_cmap(cmap):
23162304

23172305

23182306
@docstring.copy_dedent(_imread)
2319-
def imread(*args, **kwargs):
2320-
return _imread(*args, **kwargs)
2307+
def imread(fname, format=None):
2308+
return _imread(fname, format)
23212309

23222310

23232311
@docstring.copy_dedent(_imsave)
2324-
def imsave(*args, **kwargs):
2325-
return _imsave(*args, **kwargs)
2312+
def imsave(fname, arr, **kwargs):
2313+
return _imsave(fname, arr, **kwargs)
23262314

23272315

23282316
def matshow(A, fignum=None, **kw):

0 commit comments

Comments
 (0)