您需要
legend使用
propkwag将字体属性显式传递给函数:
from matplotlib import font_managerfontP = font_manager.FontProperties()fontP.set_family('SimHei')fontP.set_size(14)fig = pd.Dataframe({ '债券收益率':bond, '债券型基金收益率':bondFunds, '被动指数型基金收益率':indexFunds, '总收益率':ret})fig.plot()# Note the next linesplt.legend(loc=0, prop=fontP)plt.title('债券收益率', fontproperties=fontP)plt.grid(True)plt.axis('tight')资源



