Python 中文绘图
指定字体
在 Windows 这种内置了中文字体的系统可以直接使用系统自带的中文字体
plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False
指定字体路径
font_path = '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc' font = FontProperties(fname=font_path)
在需要的地方制定字体
plt.title('标题', fontproperties=font)