Skip to content

Font warning: ... font family ['sans-serif'] not found. Falling back to DejaVu Sans ... when using fig.canvas.draw() #8876

@lucainnocenti

Description

@lucainnocenti

Bug report

Bug summary
Using fig.canvas.draw() to redraw a plot produces the following warning:

/home/myname/anaconda3/lib/python3.6/site-packages/matplotlib/font_manager.py:1297: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans
  (prop.get_family(), self.defaultFamily[fontext]))

It doesn't happen if I just plot the code, only when using fig.canvas.draw() to plot things dynamically.
I experience this when running the code in Anaconda, in bash, in Ubuntu, under Windows 10.
I tried to delete the content of ~/.cache/ (and of the corresponding folder in the windows anaconda installation, just to be sure), but the warning still appears.
I also tried installing font-manager as suggested here, but with no effect.

Code for reproduction

import matplotlib.pyploy as plt
import seaborn
%matplotlib notebook
fig, ax = plt.subplots(1, 1)
ax.plot([0, 1, 2, 3], '-b')
fig.canvas.draw()

Actual outcome
image 1

Matplotlib version

  • Operating System: Ubuntu in Windows 10 64bit
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.1, provided by conda 4.3.2.2
  • Jupyter Version: 4.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions