arn*_*ldo 7 matplotlib python-2.7 seaborn
我的系统中安装了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,第二个字体为Arial Liberation Sans.
As suggested by @BenjaminRoot to delete the font cache on ~/.matplotlib
In fact in my Debian system, with python stuff inside virtualenv ecosystem, such folder was located at ~/.cache/matplotlib/
I have deleted all files and folder and the cache was regenerated again.
Now it works! =]
| 归档时间: | 
 | 
| 查看次数: | 4556 次 | 
| 最近记录: |