matplotlib 在 Linux 上从哪里查找字体?

使用以下代码查找

matplotlib_font_dirs.py
import matplotlib.font_manager
print(matplotlib.font_manager.X11FontDirectories)

在我的 Ubuntu 22.04 上,这列出:

matplotlib_font_dirs_output.py
['/usr/X11R6/lib/X11/fonts/TTF/',
 '/usr/X11/lib/X11/fonts',
 '/usr/share/fonts/',
 '/usr/local/share/fonts/',
 '/usr/lib/openoffice/share/fonts/truetype/',
 '~/.local/share/fonts',
 '~/.fonts']

Check out similar posts by category: Python