8000 Make pyplot signatures of rgrids() and thetagrids() explicit · matplotlib/matplotlib@962364a · GitHub
[go: up one dir, main page]

Skip to content

Commit 962364a

Browse files
committed
Make pyplot signatures of rgrids() and thetagrids() explicit
1 parent f843ffd commit 962364a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,8 +1349,7 @@ def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs):
13491349
t.update(kwargs)
13501350
return self.xaxis.get_ticklines(), self.xaxis.get_ticklabels()
13511351

1352-
def set_rgrids(self, radii, labels=None, angle=None, fmt=None,
1353-
**kwargs):
1352+
def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs):
13541353
"""
13551354
Set the radial gridlines on a polar plot.
13561355

lib/matplotlib/pyplot.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ def yticks(ticks=None, labels=None, **kwargs):
15441544
return locs, labels
15451545

15461546

1547-
def rgrids(*args, **kwargs):
1547+
def rgrids(radii=None, labels=None, angle=None, fmt=None, **kwargs):
15481548
"""
15491549
Get or set the radial gridlines on the current polar plot.
15501550
@@ -1606,15 +1606,17 @@ def rgrids(*args, **kwargs):
16061606
ax = gca()
16071607
if not isinstance(ax, PolarAxes):
16081608
raise RuntimeError('rgrids only defined for polar axes')
1609-
if not args and not kwargs:
1609+
if all(p is None for p in [radii, labels, angle, fmt]) and not kwargs:
16101610
lines = ax.yaxis.get_gridlines()
16111611
labels = ax.yaxis.get_ticklabels()
16121612
else:
1613-
lines, labels = ax.set_rgrids(*args, **kwargs)
1613+
lines, labels = ax.set_rgrids(radii,
1614+
labels=labels, angle=angle, fmt=fmt,
1615+
**kwargs)
16141616
return lines, labels
16151617

16161618

1617-
def thetagrids(*args, **kwargs):
1619+
def thetagrids(angles=None, labels=None, fmt=None, **kwargs):
16181620
"""
16191621
Get or set the theta gridlines on the current polar plot.
16201622
@@ -1673,11 +1675,12 @@ def thetagrids(*args, **kwargs):
16731675
ax = gca()
16741676
if not isinstance(ax, PolarAxes):
16751677
raise RuntimeError('thetagrids only defined for polar axes')
1676-
if not args and not kwargs:
1678+
if all(param is None for param in [angles, labels, fmt]) and not kwargs:
16771679
lines = ax.xaxis.get_ticklines()
16781680
labels = ax.xaxis.get_ticklabels()
16791681
else:
1680-
lines, labels = ax.set_thetagrids(*args, **kwargs)
1682+
lines, labels = ax.set_thetagrids(angles,
1683+
labels=labels, fmt=fmt, **kwargs)
16811684
return lines, labels
16821685

16831686

0 commit comments

Comments
 (0)
0