我在我的系统中安装了Arial字体:
/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf
/usr/share/fonts/truetype/msttcorefonts/arialbi.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
/usr/share/fonts/truetype/msttcorefonts/arial.ttf
/usr/share/fonts/truetype/msttcorefonts/ariali.ttf
/usr/share/fonts/truetype/msttcorefonts/arialbd.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf
/usr/share/fonts/truetype/msttcorefonts/Arial_Black.ttf
/usr/share/xbmc/media/Fonts/arial.ttf
/usr/local/share/texmf/fonts/tfm/urw/arial
/usr/local/share/texmf/fonts/afm/urw/arial
/usr/local/share/texmf/fonts/vf/urw/arial
/usr/local/share/texmf/fonts/type1/urw/arial
我已经在我的matplotlibrc文件中进行了更改,包括以下行:
font.sans-serif : Arial
如果我在IPython中检查:
import matplotlib.pyplot as plt
plt.plot([1,2,3,4,5,], '*')
t = plt.ylabel(r'1, 2, 3, 8, 9 6 11 Testing Label')
print(t.get_fontname())
输出结果为:
myhome/local/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-
x86_64.egg/matplotlib/font_manager.py:1279: UserWarning: findfont: Font
family [u'sans-serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
Bitstream Vera Sans
我该如何改变这种行为并在所有图表中使用Arial字体?
为什么Arial字体没有被加载?
有趣的是,如果我使用Seaborn,则返回Liberation Sans
,其中第一个字体(内部字体列表中)是Arial,第二个字体是Liberation Sans
。