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: enter image description here

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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -