【发布时间】:2014-06-06 02:45:39
【问题描述】:
我无法避免 matplotlib 中关于字体选择的错误。每当我尝试在 Linux 中的远程机器上绘图时,我都会收到以下错误:
/home/josh/anaconda/envs/py27/lib/python2.7/site-packages/matplotlib/font_manager.py:1236:
UserWarning: findfont: Font family ['Arial'] not found.
Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
我已经编辑了我的.matplotlibrc 文件(以防万一,在两个位置):
.matplotlib/.matplotlibrc.config/matplotlib/.matplotlibrc
我在其中添加了以下几行:
backend: Agg
font.family : serif
font.serif : Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman
font.sans-serif : Helvetica, Avant Garde, Computer Modern Sans serif
font.cursive : Zapf Chancery
font.monospace : Courier, Computer Modern Typewriter
text.usetex : true
不过,matplotlib 一直在抱怨 Arial。为什么? (注意这是在使用 python my_script.py 运行脚本时),不涉及 IPython。
【问题讨论】:
-
添加了 seaborn 标签。如果你没有使用直接的 matplotlib,你应该指出你正在使用什么扩展层。
标签: python matplotlib seaborn