Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Documentation Link
https://matplotlib.org/stable/users/explain/fonts.html#how-matplotlib-selects-fonts
Problem
The documentation is vague regarding how one should go about letting matplotlib find a directory filled with custom font files.
My current problem is that I want matplotlib, per default, to load a few font files that I cannot install systemwide, because I do not have the rights to do so (linux server). Typically, on Linux, custom fonts are stored either in~/.fonts/
or~/.local/share/fonts/
. Yet, even after rebuilding the linux font cache, matplotlib does not find any of the custom fonts. Previously, I made that happen by copy-pasting the files to matplotlib's.../mpl-data/ttf/
directory, but that does not seem to work anymore (matplotlib version: 3.6.2). In earlier version there existed afontList.cache
but that does not exist anymore either.
Suggested improvement
There should be an extra section explaining how to set up a custom font-file or font-directory that matplotlib will remember to search when imported. Obviously I'm fine with whatever solution any current matplotlib version has for this problem, but the documentation is lacking clear communication on how to solve it.