10000 Discourage fontdict · matplotlib/matplotlib@c447d73 · GitHub
[go: up one dir, main page]

Skip to content

Commit c447d73

Browse files
committed
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.
1 parent e7fd79f commit c447d73

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,
116116
Text to use for the title
117117
118118
fontdict : dict
119+
120+
.. admonition:: Discouraged
121+
122+
The use of *fontdict* is discouraged. You can pass all parameters as
123+
individual keyword arguments, which is simpler if you only want to
124+
modidfy one or two properties. If you already have a dict, use
125+
dictionary-unpacking: ``set_title(..., **fontdict)``.
126+
119127
A dictionary controlling the appearance of the title text,
120128
the default *fontdict* is::
121129
@@ -641,6 +649,14 @@ def text(self, x, y, s, fontdict=None, **kwargs):
641649
The text.
642650
643651
fontdict : dict, default: None
652+
653+
.. admonition:: Discouraged
654+
655+
The use of *fontdict* is discouraged. You can pass all parameters as
656+
individual keyword arguments, which is simpler if you only want to
657+
modidfy one or two properties. If you already have a dict, use
658+
dictionary-unpacking: ``text(..., **fontdict)``.
659+
644660
A dictionary to override the default text properties. If fontdict
645661
is None, the defaults are determined by `.rcParams`.
646662

lib/matplotlib/axis.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,14 @@ def set_label_text(self, label, fontdict=None, **kwargs):
17531753
Text string.
17541754
fontdict : dict
17551755
Text properties.
1756+
1757+
.. admonition:: Discouraged
1758+
1759+
The use of *fontdict* is discouraged. You can pass all parameters as
1760+
individual keyword arguments, which is simpler if you only want to
1761+
modidfy one or two properties. If you already have a dict, use
1762+
dictionary-unpacking: ``set_label_text(..., **fontdict)``.
1763+
17561764
**kwargs
17571765
Merged into fontdict.
17581766
"""
@@ -1913,6 +1921,14 @@ def set_ticklabels(self, labels, *, minor=False, fontdict=None, **kwargs):
19131921
If True, set minor ticks instead of major ticks.
19141922
19151923
fontdict : dict, optional
1924+
1925+
.. admonition:: Discouraged
1926+
1927+
The use of *fontdict* is discouraged. You can pass all parameters as
1928+
individual keyword arguments, which is simpler if you only want to
1929+
modidfy one or two properties. If you already have a dict, use
1930+
dictionary-unpacking: ``set_ticklabels(..., **fontdict)``.
1931+
19161932
A dictionary controlling the appearance of the ticklabels.
19171933
The default *fontdict* is::
19181934

0 commit comments

Comments
 (0)
0