python图例用法_添加图例plot-CSDN博客

网站介绍:文章浏览阅读3w次,点赞11次,收藏27次。python图例用法1、方式一import matplotlib.pyplot as pltimport numpy as npX=np.linspace(-np.pi,np.pi)Y=np.cos(X)Y1=np.sin(X)#增加label# plt.plot(X,Y,label="Cos(X)")# plt.plot(X,Y1,label="Sin(X)")#指定图例位置,1右上_添加图例plot