Closed
Description
Bug report
Bug summary
Documentation for matplotlib.text.Text.set_fontfamily
(https://matplotlib.org/api/text_api.html#matplotlib.text.Text.set_fontfamily ) could be edited to explain:
- its value defaults to
matplotlib.rcParams['font.family']
- constructing
Text(fontfamily=None)
sets font tomatplotlib.rcParams['font.family']
- calling
set_fontfamily()
on an existing Text instance does the same thing- pycharm complains that "Expected type 'str', got 'None' instead", but the program works fine at runtime.
(Also https://matplotlib.org/api/font_manager_api.html#matplotlib.font_manager.FontProperties.set_family should be edited too.)
I confirmed the behaviors by editing my program:
- edit rcParams
- create Text (actually Annotation which subclasses Text) via
Axes.annotate
FontProperties._family
starts out at rcParams['font.family']
, and .set_family(None)
replaces argument with rcParams['font.family']
, (both call _normalize_font_family() afterwards).
I'm not sure when this behavior was introduced.