legend的在函数中的位置有要求,
matplotlib.pyplot.legend()
需要放在
matplotlib.pyplot.show()的前一行,可以正常显示内容
本文介绍如何在使用matplotlib.pyplot绘制图表时正确地放置legend。关键在于确保legend的调用位于show()方法之前,这样可以保证legend正常显示。
legend的在函数中的位置有要求,
matplotlib.pyplot.legend()
需要放在
matplotlib.pyplot.show()的前一行,可以正常显示内容
2646
2759

被折叠的 条评论
为什么被折叠?
