我正在尝试使用 PyWaffle ( https://github.com/ligyxy/PyWaffle ) 来绘制华夫饼图。
我已经安装了模块并且我已经安装了 PyWaffle 使用的 fontawesome 字体 ( https://fontawesome.com/?from=io )。
然后我运行 Git 存储库中提供的以下代码。
data = {'Democratic': 48, 'Republican': 46, 'Libertarian': 3}
fig = plt.figure(
FigureClass=Waffle,
rows=5,
values=data,
colors=("#232066", "#983D3D", "#DCB732"),
legend={'loc': 'upper left', 'bbox_to_anchor': (1, 1)},
icons='child', icon_size=18,
icon_legend=True
)
相反,我得到以下异常。
FileNotFoundError:[Errno 2] 没有这样的文件或目录:'font/FontAwesome.otf'
我用来安装 FontAwesome 的步骤是在他们的网站上列出的:
我右键单击字体并选择:安装。