1

There have been many threads on this already (Force matplotlibrc to use Arial (path of font), How to load .ttf file in matplotlib using mpl.rcParams?). None seems to help in my case. I have number of fonts installed on my system and registered in matplotlib. Everything seems to work when I am in the shell:

>>> import matplotlib as mpl
>>> from matplotlib import font_manager
>>> path = '/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf'
>>> props = font_manager.FontProperties(fname=path)
>>> print props
family=Times New Roman ... file=/usr/.../Times_New_Roman.ttf ...
>>> mpl.rcParams['font.family'] = props.get_name()
>>> mpl.rcParams
RcParams({...,u'font.family': [u'Times New Roman'], ... })

However, when I try to do the same in a script and run it (and I have tried a dozen times), I get:

/usr/local/lib/python2.7/dist-packages/matplotlib/font_manager.py:1282: UserWarning: findfont: Font family [u'Times New Roman'] not found.

Why?

Community
  • 1
  • 1
  • Try displaying the version numbers in both cases, e.g. `print mpl.__version__, sys.version` – Martin Evans Oct 02 '15 at 10:18
  • I am running mpl 1.4.3 and Python 2.7.6. These versions are reported in both cases. Btw. I have tried to run the same script with Anaconda on Win 7 and it works perfectly fine. – Mitya Stiglitz Oct 02 '15 at 10:52

0 Answers0