8000 Small API cleanups to plot_directive. by anntzer · Pull Request #18682 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Small API cleanups to plot_directive. #18682

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
Oct 8, 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
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/18682-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``sphinext.plot_directive.align``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... is deprecated. Use ``docutils.parsers.rst.directives.images.Image.align``
instead.
12 changes: 4 additions & 8 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -258,7 +255,6 @@ def run(self):


def setup(app):
import matplotlib
setup.app = app
setup.config = app.config
setup.confdir = app.confdir
Expand Down
0