Skip to content

Deprecate :encoding: option to .. plot::, which has no effect since 2011 #20540

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
Jun 28, 2021
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
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/deprecations/20540-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``:encoding:`` option to ``.. plot`` directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This option has had no effect since Matplotlib 1.3.1, and is now deprecated.
7 changes: 6 additions & 1 deletion lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ def _option_format(arg):
return directives.choice(arg, ('python', 'doctest'))


def _deprecated_option_encoding(arg):
_api.warn_deprecated("3.5", "encoding", obj_type="option")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the error in #20543, it looks like this is missing a name=?

return directives.encoding(arg)


def mark_plot_labels(app, document):
"""
To make plots referenceable, we need to move the reference from the
Expand Down Expand Up @@ -242,7 +247,7 @@ class PlotDirective(Directive):
'format': _option_format,
'context': _option_context,
'nofigs': directives.flag,
'encoding': directives.encoding,
'encoding': _deprecated_option_encoding,
'caption': directives.unchanged,
}

Expand Down