On a Ubuntu 12.04 machine, whenever I plot something I get an error like:
/usr/lib/pymodules/python2.7/matplotlib/font_manager.py:1228: UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=normal:variant=normal:weight=medium:stretch=normal:size=x-large. Returning /usr/share/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
which I cannot find a solution to online. The following code reproduces the error
import pylab as plt
plt.plot(np.random.random((128)))
plt.title("This should be monospaced")
plt.savefig("/tmp/testfig.pdf")
and also the matplotlib self test gives this error:
python -c "import matplotlib as m ; m.test(verbosity=1)"
In ~/.matplotlib/matplotlibrc
I have:
font.family : monospace
font.style : normal
font.variant : normal
font.weight : medium
font.stretch : normal
font.size : 10.0
font.serif : Palatino, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Charter, serif
font.sans-serif : Helvetica, Bitstream Vera Sans, sans-serif
font.monospace : Monaco, Ubuntu Mono Regular, Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Fixed, Terminal, monospace
Some things that do not solve the problem for me:
- Delete files in
~/.matplotlib/
(i.e.matplotlibrc
,fontList.cache
,tex.cache/
) - Change the
font.family
property in~/.matplotlib/matplotlibrc
- Re-install matplotlib after an
apt-get purge
The versions I use are:
- matplotlib 1.1.1~rc1+git20120423-0ubuntu1
- Python 2.7.3
- IPython 0.12.1
- Ubuntu 12.04
~/.matplotlib/
on Ubuntu 16.04 with matplotlib 2.2.3. Where are the cache files I should delete?