如何解决 UserWarning: findfont: Could not match :family=Bitstream Vera Sans

2024-01-12

下列的这个例子 http://matplotlib.org/users/transforms_tutorial.html#axes-coordinates:

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
for i, label in enumerate(('A', 'B', 'C', 'D')):
    ax = fig.add_subplot(2,2,i+1)
    ax.text(0.05, 0.95, label, transform=ax.transAxes,
      fontsize=16, fontweight='bold', va='top')

plt.show()

我得到这个输出:

为什么我的标签是正常重量,而文档显示这应该创建粗体字母A, B, C, D?

我也收到这个警告:

Warning (from warnings module):
File "C:\Python27\lib\site-packages\matplotlib\font_manager.py", line 1228
UserWarning)
UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=italic:variant=normal:weight=bold:stretch=normal:size=x-small. Returning C:\Python27\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf

OP 分辨率

  • From a deleted answer posted by the OP https://stackoverflow.com/a/18814074/7758804 on Sep 15, 2013
    • 好吧,是安装的问题matplotlib

尝试使用weight代替fontweight.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何解决 UserWarning: findfont: Could not match :family=Bitstream Vera Sans 的相关文章

随机推荐