Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Plotting legend throws error "font family ['serif'] not found. Falling back to DejaVu Sans" #17518

Copy link
Copy link
Closed
@Struan-Murray

Description

@Struan-Murray
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.