import matplotlib.pyplot as pltimport matplotlib as mpl'''mpl.rcParams['font.sans-serif'] = ['FangSong'] 设置中文字体的方法mac不适用,windows应该可以'''font = mpl.font_manager.FontProperties(fname='/System/Library/Fonts/STHeiti Light.ttc') # 不设置中文字体会显示成方块,图表显示的中文必须为......