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

Skip to content

Commit a71634c

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

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-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: 8 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,16 @@ 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(
1614+
radii, labels=labels, angle=angle, fmt=fmt, **kwargs)
16141615
return lines, labels
16151616

16161617

1617-
def thetagrids(*args, **kwargs):
1618+
def thetagrids(angles=None, labels=None, fmt=None, **kwargs):
16181619
"""
16191620
Get or set the theta gridlines on the current polar plot.
16201621
@@ -1673,11 +1674,12 @@ def thetagrids(*args, **kwargs):
16731674
ax = gca()
16741675
if not isinstance(ax, PolarAxes):
16751676
raise RuntimeError('thetagrids only defined for polar axes')
1676-
if not args and not kwargs:
1677+
if all(param is None for param in [angles, labels, fmt]) and not kwargs:
16771678
lines = ax.xaxis.get_ticklines()
16781679
labels = ax.xaxis.get_ticklabels()
16791680
else:
1680-
lines, labels = ax.set_thetagrids(*args, **kwargs)
1681+
lines, labels = ax.set_thetagrids(angles,
1682+
labels=labels, fmt=fmt, **kwargs)
16811683
return lines, labels
16821684

16831685

0 commit comments

Comments
 (0)