8000 Make pyplot signatures of rgrids() and thetagrids() explicit by timhoffm · Pull Request #17311 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Make pyplot signatures of rgrids() and thetagrids() explicit #17311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2020
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
3 changes: 1 addition & 2 deletions lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,8 +1349,7 @@ def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs):
t.update(kwargs)
return self.xaxis.get_ticklines(), self.xaxis.get_ticklabels()

def set_rgrids(self, radii, labels=None, angle=None, fmt=None,
**kwargs):
def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs):
"""
Set the radial gridlines on a polar plot.

Expand Down
14 changes: 8 additions & 6 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ def yticks(ticks=None, labels=None, **kwargs):
return locs, labels


def rgrids(*args, **kwargs):
def rgrids(radii=None, labels=None, angle=None, fmt=None, **kwargs):
"""
Get or set the radial gridlines on the current polar plot.

Expand Down Expand Up @@ -1606,15 +1606,16 @@ def rgrids(*args, **kwargs):
ax = gca()
if not isinstance(ax, PolarAxes):
raise RuntimeError('rgrids only defined for polar axes')
if not args and not kwargs:
if all(p is None for p in [radii, labels, angle, fmt]) and not kwargs:
lines = ax.yaxis.get_gridlines()
labels = ax.yaxis.get_ticklabels()
else:
lines, labels = ax.set_rgrids(*args, **kwargs)
lines, labels = ax.set_rgrids(
radii, labels=labels, angle=angle, fmt=fmt, **kwargs)
return lines, labels


def thetagrids(*args, **kwargs):
def thetagrids(angles=None, labels=None, fmt=None, **kwargs):
"""
Get or set the theta gridlines on the current polar plot.

Expand Down Expand Up @@ -1673,11 +1674,12 @@ def thetagrids(*args, **kwargs):
ax = gca()
if not isinstance(ax, PolarAxes):
raise RuntimeError('thetagrids only defined for polar axes')
if not args and not kwargs:
if all(param is None for param in [angles, labels, fmt]) and not kwargs:
lines = ax.xaxis.get_ticklines()
labels = ax.xaxis.get_ticklabels()
else:
lines, labels = ax.set_thetagrids(*args, **kwargs)
lines, labels = ax.set_thetagrids(angles,
labels=labels, fmt=fmt, **kwargs)
return lines, labels


Expand Down
0