没写 plt.legend() 这个 !
- # 效果模拟--------------
- import matplotlib.pyplot as plt
- import matplotlib as mpl
- # matplotlib其实是不支持显示中文的 显示中文需要一行代码设置字体
- mpl.rcParams['font.family'] = 'STKAITI' # 'STKAITI'——字体
- plt.rcParams['axes.unicode_minus'] = False # 解决坐标轴负数的负号显示问题
- # 新建一个图像
- plt.figure(figsize=(16,8))
- # 绘画某些结点第一天的情况(即前 288 个结点)
- plt.plot(data.iloc[100:300,73].values.reshape(-1),c='blue',label='tree')
-
- plt.plot(data.iloc[100:300,70].values.reshape(-1),label='70',c='red')
-
- plt.plot(data.iloc[100:300,80].values.reshape(-1),c='green',label='80')
-
- plt.plot(data.iloc[100:300,90].values.reshape(-1),c='orange',label='90')
- # plt.legend()
- # 展示图像
- plt.show()

加上这个plt.legend(