diff --git a/doc/api/next_api_changes/deprecations/18682-AL.rst b/doc/api/next_api_changes/deprecations/18682-AL.rst new file mode 100644 index 000000000000..e69b9013ff36 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/18682-AL.rst @@ -0,0 +1,4 @@ +``sphinext.plot_directive.align`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated. Use ``docutils.parsers.rst.directives.images.Image.align`` +instead. diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py index 28aeeb394478..2f29dc00b3c3 100644 --- a/lib/matplotlib/sphinxext/plot_directive.py +++ b/lib/matplotlib/sphinxext/plot_directive.py @@ -159,7 +159,9 @@ from matplotlib import _pylab_helpers, cbook matplotlib.use("agg") -align = Image.align +align = cbook.deprecated( + "3.4", alternative="docutils.parsers.rst.directives.images.Image.align")( + Image.align) __version__ = 2 @@ -191,11 +193,6 @@ def _option_format(arg): return directives.choice(arg, ('python', 'doctest')) -def _option_align(arg): - return directives.choice(arg, ("top", "middle", "bottom", "left", "center", - "right")) - - def mark_plot_labels(app, document): """ To make plots referenceable, we need to move the reference from the @@ -238,7 +235,7 @@ class PlotDirective(Directive): 'height': directives.length_or_unitless, 'width': directives.length_or_percentage_or_unitless, 'scale': directives.nonnegative_int, - 'align': _option_align, + 'align': Image.align, 'class': directives.class_option, 'include-source': _option_boolean, 'format': _option_format, @@ -258,7 +255,6 @@ def run(self): def setup(app): - import matplotlib setup.app = app setup.config = app.config setup.confdir = app.confdir