matplotlib 使用 Windows 系统字体

 
导入 FontProperties

from matplotlib.font_manager import FontProperties
可以使用自己电脑上(C:\Windows\Fonts)的字体

font = FontProperties(fname=r"C:\Windows\Fonts\simhei.ttf", size=12) 

使用字体

plt.xlabel("X轴标题",FontProperties=font)


 

posted @ 2025-11-12 11:44  emanlee  阅读(8)  评论(0)    收藏  举报