I am unable to avoid an error in matplotlib regarding font choice. Whenever I try to plot on a remote machine in Linux I get the following error:
/home/josh/anaconda/envs/py27/lib/python2.7/site-packages/matplotlib/font_manager.py:1236:
UserWarning: findfont: Font family ['Arial'] not found.
Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
I have edited my .matplotlibrc
file (just in case, in two locations):
.matplotlib/.matplotlibrc
.config/matplotlib/.matplotlibrc
Where I added the following lines:
backend: Agg
font.family : serif
font.serif : Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman
font.sans-serif : Helvetica, Avant Garde, Computer Modern Sans serif
font.cursive : Zapf Chancery
font.monospace : Courier, Computer Modern Typewriter
text.usetex : true
Still, matplotlib
keeps complaining about Arial
. Why? (note this is when running a script with python my_script.py
) with no IPython involved.
If you're using seaborn and don't have Arial installed, this will happen (I'm actually currently in the process of making this work better). Best solution for the time being would be to call
sns.set(font="serif")
After importing seaborn and before plotting.
from the documentation (see method description for set_family
or set_name
)
Real font names are not supported when text.usetex is True.
Perhaps you should use a font family like 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace' if you'd like to be able to use TeX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With