Use arial font in matplotlib -
when run python script (plot_lhoc.py in rosetta package) make plot, got following error message:
/app/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:1297: userwarning: findfont: font family [u'arial'] not found. falling dejavu sans (prop.get_family(), self.defaultfamily[fontext]))
i guessed cause absence of arial font in matplotlib. in deed, /app/anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/ directory didn't contain arial.ttf file. copy arial*.ttf file /usr/share/fonts/msttcore /app/anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/ directory
[root@bogon /]#cp /usr/share/fonts/msttcore/arial*.ttf /app/anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/
after that, however, running plot_lhoc.py script gave same "font family [u'arial'] not found" error.
i displayed items in target directory:
i don't understand why arial* items don't have blue background color while other items have, , strangely, "locate" command cannot find arial.ttf file can find other ttf files:
[root@bogon /]# locate cmss10.ttf /app/anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf /app/anaconda2/pkgs/matplotlib-2.0.2-np112py27_0/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf [root@bogon /]# locate arial.ttf [root@bogon /]#
it seems althoug arial.ttf copied "matplotlib/mpl-data/fonts/ttf" directory, matplotlib cannot use yet.
could tell me how solve "font family [u'arial'] not found" problem?
best regards, yeping sun
wiki
Comments
Post a Comment