my_font = FontProperties(fname=r"C:\Users\...\AppData\Local\Programs\Python\Python310\Lib\site-packages\matplotlib\mpl-data\fonts\ttf\simhei.ttf", size=12)
# 添加图例
plt.legend(prop={'family': 'SimHei', 'size': 10}) # 设置图例字体为黑体
# 添加标题和标签
plt.title('每日发帖数随时间变化图', fontproperties='SimHei', fontsize=14) # 设置标题字体为黑体
plt.xlabel('日期', fontproperties='SimHei', fontsize=12) # 设置x轴标签字体为黑体
plt.ylabel('发帖数', fontproperties='SimHei', fontsize=12) # 设置y轴标签字体为黑体