0

我正在尝试在 matplotlib 中将默认字体类型设置为“Times New Roman”,但它说“/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font找不到家庭 ['times new roman']。回退到 DejaVu Sans。(prop.get_family(), self.defaultFamily[fontext]))"。但是当我使用关键字“Times new roman”时,它没有向我显示上述错误,但我仍然很确定正在生成的 folt 不是 Times New Roman

请帮忙,我需要 Times new roan 字体作为默认字体

 import matplotlib.pyplot as plt
 plt.rcParams["font.family"] = "times new roman"

plt.figure(figsize=(10,8))
plt.plot([1,2,3], [1,2,3])
plt.title('title', fontsize = 30)
plt.xlabel('title', fontsize = 30)
plt.savefig("/content/after.png", dpi = 500, bbox_inches='tight')
plt.show()

使用“Times new roman”之前使用“Times new roman” 之后

4

0 回答 0