Matplotlib制作图例时报错No handles with labels found to put in legend.解决办法
1.问题现象
报错:No handles with labels found to put in legend.
2. 解决办法
1)“画图”时未指定label
(如下图,没有红框中的内容)
对应的解决办法:添加上即可
2)制作图例在画图之前,则也会报错
对应的解决办法:先plt.plot(),再plt.legend()
如下图:
1.问题现象
报错:No handles with labels found to put in legend.
2. 解决办法
1)“画图”时未指定label
(如下图,没有红框中的内容)
对应的解决办法:添加上即可
2)制作图例在画图之前,则也会报错
对应的解决办法:先plt.plot(),再plt.legend()
如下图: