From c8ccd84af795c1b41e6519e2af4030cf8954add9 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 31 Mar 2020 22:51:19 +0200 Subject: [PATCH] Make plt.{r,theta}grids act as setters even when all args are kwargs. I'm going to claim that silently ignoring kwargs was a bug and thus this behavior can be changed with just a note, but no deprecation. --- doc/api/next_api_changes/behaviour.rst | 5 +++++ lib/matplotlib/pyplot.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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: