From 68266ef52a6e1d266614aca3040b430ade3c2c07 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 26 Apr 2023 13:24:59 +0200 Subject: [PATCH] Small axislines.Axes cleanups. - Deprecate the "callable axes" API, which is not present anywhere else nor documented nor tested. - No need to set the transform on the GridlinesCollection; _set_artist_props takes care of that. --- doc/api/next_api_changes/deprecations/25774-AL.rst | 4 ++++ lib/mpl_toolkits/axisartist/axislines.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 doc/api/next_api_changes/deprecations/25774-AL.rst diff --git a/doc/api/next_api_changes/deprecations/25774-AL.rst b/doc/api/next_api_changes/deprecations/25774-AL.rst new file mode 100644 index 000000000000..0b47d4ebffe7 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/25774-AL.rst @@ -0,0 +1,4 @@ +Callable axisartist Axes +~~~~~~~~~~~~~~~~~~~~~~~~ +Calling an axisartist Axes to mean `~pyplot.axis` is deprecated; explicitly +call the method instead. diff --git a/lib/mpl_toolkits/axisartist/axislines.py b/lib/mpl_toolkits/axisartist/axislines.py index e63c3b39646c..35717da8eaa9 100644 --- a/lib/mpl_toolkits/axisartist/axislines.py +++ b/lib/mpl_toolkits/axisartist/axislines.py @@ -407,6 +407,7 @@ def get_gridlines(self, which="major", axis="both"): class Axes(maxes.Axes): + @_api.deprecated("3.8", alternative="ax.axis") def __call__(self, *args, **kwargs): return maxes.Axes.axis(self.axes, *args, **kwargs) @@ -440,7 +441,7 @@ def clear(self): # Init gridlines before clear() as clear() calls grid(). self.gridlines = gridlines = GridlinesCollection( - [], transform=self.transData, + [], colors=mpl.rcParams['grid.color'], linestyles=mpl.rcParams['grid.linestyle'], linewidths=mpl.rcParams['grid.linewidth'])