如何解决 UserWarning: findfont: 无法匹配 :family=Bitstream Vera Sans [英] How to resolve UserWarning: findfont: Could not match :family=Bitstream Vera Sans
本文介绍了如何解决 UserWarning: findfont: 无法匹配 :family=Bitstream Vera Sans的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按照
- 好的,是
matplotlib
的安装有问题
解决方案
尝试使用 weight
而不是 fontweight
.
Following this example:
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()
I get this output:
Why are my labels normal weight, while the documentation shows this should create bold letters A
, B
, C
, D
?
I also get this warning:
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 Resolution
- From a deleted answer posted by the OP on
Sep 15, 2013
- Ok, it was a problem with the installation of
matplotlib
- Ok, it was a problem with the installation of
解决方案
Try using weight
instead of fontweight
.
这篇关于如何解决 UserWarning: findfont: 无法匹配 :family=Bitstream Vera Sans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文