Matplotlib warning about no LaTeX-compatible font.
See original GitHub issueHi,
Whenever I use this package setting
plt.style.use(["science"])
plt.style.reload_library()
I get the following warning sign multiple times when I plot anything:
matplotlib.texmanager - INFO - No LaTeX-compatible font found for the serif font family in rcParams. Using default.
Now, I have investigated a little, this warning is issued here:
so it looks like it cannot found the specified font in the attribute TexManager.font_info
. I have printed the font that is trying to look at, and it is “Times New Roman”, as you would expect, but indeed that font is not found in the font_info
dictionary:
What am I missing here? I am using:
SciencePlots: latest commite release Matplotlib: 3.3.0 OS: Manjaro 20.2 Tex: Texlive installation with these packages:
texlive-bibtexextra
texlive-core
texlive-fontsextra
texlive-formatsextra
texlive-games
texlive-humanities
texlive-latexextra
texlive-music
texlive-pictures
texlive-pstricks
texlive-publishers
texlive-science
Thank you very much for your help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Matplotlib not using latex font while text.usetex==True
I want to create labels to my plots with the latex computer modern font. However, the only way to persuade matplotlib to use...
Read more >texmanager.py:137 - matplotlib-devel - Matplotlib
Hi all, Is there a way to suppress the warning /usr/local/lib64/python2.5/site-packages/matplotlib/texmanager.py:137: UserWarning: No LaTeX-compatible font ...
Read more >Legend guide — Matplotlib 3.6.2 documentation
The text which describes the handle represented by the key. ... Calling legend() with no arguments automatically fetches the legend handles and their ......
Read more >matplotlib.collections — Matplotlib 3.6.2 documentation
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the...
Read more >GitLab Flavored Markdown (GLFM)
When you enter text in the GitLab UI, GitLab assumes the text is in the Markdown language. The text is rendered with a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @arnauqb
You got that warning because the given font
Times New Roman
inscience
style can’t be found in yourmatplotlib
cache. TheTimes New Roman
is a font licensed to Microsoft from Monotype so you can’t find that font in your machine which runs with Linux operating system.There are two steps to solve your problem:
Install the
Times New Roman
fonts on your system.There are two packages
ttf-times-new-roman
andttf-ms-fonts
in AUR (Arch User Repository) and you can install one of them by the package manageryay
oryaourt
in your Manjaro system.Then clear the font cache of
matplotlib
.After installing those fonts and regenerate the cache, you can directly use them in software like PyCharm or LibreOffice but still get that warning in
matplotlib
. You should find out the path of the font cache ofmatplotlib
and clear it.If you don’t know the path of the font cache of
matplotlib
. Just typepython
in your terminal and run the commands below in the interactive Python REPL environment.Then clear the font cache of
matplotlib
by deleting that folder. (The cache would be regenerated when you runmatplotlib
next time)Hi @arnauqb
In commit 86e369f, @garrettj403 have changed the font from
Times New Roman
toTimes
. If you use the newest version ofSciencePlot
in your machine, then it would give warnings if there is noTimes
font.Would you show that warning message?