所以我有一个图,但是我不知道如何在数据中添加数据标签。我得到了所需的图,但我想查看每个点的y值。这是代码:
list_of_centers=os.listdir("./")
for i in range(len(list_of_centers)):
xls = pd.ExcelFile("./"+list_of_centers[i])
for j in range(len(xls.sheet_names)):
df=pd.read_excel("./"+list_of_centers[i])
df=df.drop(columns=['Y', 'C','O','Y_C','Y_O'])
df=df.set_index('Date')
lines = df.plot.line(title=list_of_centers[i][:-5]+"_"+xls.sheet_names[j])
#add labels
plt.savefig("./"+list_of_centers[i]
[:-5]+"_"+xls.sheet_names[j]+".png")