Closed
Description
Bug report
Bug summary
Matplotlib shows a warning when adding a legend to a graph while using the TeX backend.
Error is: findfont: Font family ['serif'] not found. Falling back to DejaVu Sans.
A typical looking graph is supplied but I'm unsure as to the correctness of the legend font.
Code for reproduction
from matplotlib import rc
import matplotlib.pyplot as plt
rc('font', **{'family':'serif','serif':'Computer Modern'})
rc('text', usetex=True)
plt.figure()
plt.plot(0,0,label='Input')
plt.title('Commenting out legend removes warning')
plt.legend()
plt.show()
Actual outcome
findfont: Font family ['serif'] not found. Falling back to DejaVu Sans.
The graph is output normally.
Expected outcome
No errors, and a key that works.
Matplotlib version
- Operating system: Ubuntu Focal Fossa GNOME Terminal 3.36.1.1
- Matplotlib version: 3.2.1
- Matplotlib backend (
print(matplotlib.get_backend())
): GTK3Agg - Python version: 3.8.2 (GCC 9.3.0 on linux)
- Jupyter version (if applicable): NA
- Other libraries:
matplotlib was installed via pip (20.1.1), and python was installed via apt.