【冰糖Python】matplotlib库 UserWarning: Legend does not support ... A proxy artist may be used instead.
在使用 matplotlib.pyplot画图添加图例:fig, ax1 = plt.subplots()line1 = ax1.plot(x, y, color='firebrick') # draw a lineax2.legend([line1], ['First'])显示以下提示:原因在于,plot 返回 的 list 对象(list of Line2D)需要解构,因此需要在line1和等号之间加一个逗号:fig, ax1 = plt.subplots()line1.
原创
2021-03-28 10:32:46 ·
3866 阅读 ·
3 评论