From 8d39a8b29766dfb88616a4ee5889d4a8285c77aa Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 1 May 2023 23:00:11 +0200 Subject: [PATCH] Discourage fontdict Closes #10293. `fontdict` is redundant API, but it's not bad enough to justify the user hassle of a deprecation. By discouraging we point the users away from `fontdict` so that the somewhat messy documentation state of `fontdict` is less of a concern. Co-authored-by: hannah --- lib/matplotlib/axes/_axes.py | 14 ++++++++++++++ lib/matplotlib/axis.py | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 38fe07873e1d..91aba7c1bdac 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -116,6 +116,13 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None, Text to use for the title fontdict : dict + + .. admonition:: Discouraged + + The use of *fontdict* is discouraged. Parameters should be passed as + individual keyword arguments or using dictionary-unpacking + ``set_title(..., **fontdict)``. + A dictionary controlling the appearance of the title text, the default *fontdict* is:: @@ -641,6 +648,13 @@ def text(self, x, y, s, fontdict=None, **kwargs): The text. fontdict : dict, default: None + + .. admonition:: Discouraged + + The use of *fontdict* is discouraged. Parameters should be passed as + individual keyword arguments or using dictionary-unpacking + ``text(..., **fontdict)``. + A dictionary to override the default text properties. If fontdict is None, the defaults are determined by `.rcParams`. diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index eb24ff1fac84..717000131b13 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1753,6 +1753,13 @@ def set_label_text(self, label, fontdict=None, **kwargs): Text string. fontdict : dict Text properties. + + .. admonition:: Discouraged + + The use of *fontdict* is discouraged. Parameters should be passed as + individual keyword arguments or using dictionary-unpacking + ``set_label_text(..., **fontdict)``. + **kwargs Merged into fontdict. """ @@ -1913,6 +1920,13 @@ def set_ticklabels(self, labels, *, minor=False, fontdict=None, **kwargs): If True, set minor ticks instead of major ticks. fontdict : dict, optional + + .. admonition:: Discouraged + + The use of *fontdict* is discouraged. Parameters should be passed as + individual keyword arguments or using dictionary-unpacking + ``set_ticklabels(..., **fontdict)``. + A dictionary controlling the appearance of the ticklabels. The default *fontdict* is::