From babdac46bbafbab9de5f4002122e86b6885d42ce Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 28 Jun 2021 15:31:24 +0200 Subject: [PATCH] Deprecate :encoding: option to .. plot::, which has no effect since 2011 (Its value is not read anywhere in the implementation since a205f5460f.) --- doc/api/next_api_changes/deprecations/20540-AL.rst | 3 +++ lib/matplotlib/sphinxext/plot_directive.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 doc/api/next_api_changes/deprecations/20540-AL.rst diff --git a/doc/api/next_api_changes/deprecations/20540-AL.rst b/doc/api/next_api_changes/deprecations/20540-AL.rst new file mode 100644 index 000000000000..49caf2d3df8f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/20540-AL.rst @@ -0,0 +1,3 @@ +``:encoding:`` option to ``.. plot`` directive +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This option has had no effect since Matplotlib 1.3.1, and is now deprecated. diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py index 890eca262580..e152ef1f3f1f 100644 --- a/lib/matplotlib/sphinxext/plot_directive.py +++ b/lib/matplotlib/sphinxext/plot_directive.py @@ -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") + return directives.encoding(arg) + + def mark_plot_labels(app, document): """ To make plots referenceable, we need to move the reference from the @@ -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, }