diff --git a/doc/api/next_api_changes/behaviour.rst b/doc/api/next_api_changes/behaviour.rst index b8a77d56e813..9ebe3fe42240 100644 --- a/doc/api/next_api_changes/behaviour.rst +++ b/doc/api/next_api_changes/behaviour.rst @@ -150,3 +150,8 @@ support for it will be dropped in a future Matplotlib release. `.font_manager.json_dump` now locks the font manager dump file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... to prevent multiple processes from writing to it at the same time. + +`.pyplot.rgrids` and `.pyplot.thetagrids` now act as setters also when called with only kwargs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, keyword arguments were silently ignored when no positional +arguments were given. diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 898d4b3f1383..3d7dd1c0ac0c 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1627,7 +1627,7 @@ def rgrids(*args, **kwargs): ax = gca() if not isinstance(ax, PolarAxes): raise RuntimeError('rgrids only defined for polar axes') - if len(args) == 0: + if not args and not kwargs: lines = ax.yaxis.get_gridlines() labels = ax.yaxis.get_ticklabels() else: @@ -1694,7 +1694,7 @@ def thetagrids(*args, **kwargs): ax = gca() if not isinstance(ax, PolarAxes): raise RuntimeError('thetagrids only defined for polar axes') - if len(args) == 0: + if not args and not kwargs: lines = ax.xaxis.get_ticklines() labels = ax.xaxis.get_ticklabels() else: