pandas绘图的时候中文会变成方块。解决方法就是选择支持中文的字体即可。
import matplotlib.font_manager as fm # 解决中文字体问题 # mac字体路径:/System/Library/Fonts/ cn_font = fm.FontProperties(fname='/System/Library/Fonts/PingFang.ttc') plt.legend(prop=cn_font)
pandas绘图的时候中文会变成方块。解决方法就是选择支持中文的字体即可。
import matplotlib.font_manager as fm # 解决中文字体问题 # mac字体路径:/System/Library/Fonts/ cn_font = fm.FontProperties(fname='/System/Library/Fonts/PingFang.ttc') plt.legend(prop=cn_font)