我如何制作图例,向我展示我正在处理的每个变量?

How I can make the legend of a plot, shows me each variable Im working on?

我正在制作叠加图,但是当我添加图例并且图例显示在图表中时,它只显示一天,像这样重复多次

imagen = plt.figure(figsize=(25,10))

for day in [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18,19,20,23,26,27,28,30]:
    dia = datos[datos['Fecha'] == "2019-06-"+(f"{day:02d}")]
    tiempo= pd.to_datetime(dia['Hora'], format=' %H:%M:%S').dt.time
    temp= dia['TEMP']
    plt.plot(tiempo, temp) #, color = 'red' )# 

plt.xlabel("Tiempo (H:M:S)(Formato 24 Horas)")
plt.ylabel("Temperatura (K)")
plt.title("Temperatura Jun 2019")
plt.legend(datos['Fecha'])
plt.show()
imagen.savefig('TEMPJUN2019')

我得到的图像是下一张:

enter image description here

尝试这样的事情:


imagen = plt.figure(figsize=(25,10))

dia_lst = [] # <======================================================= Here
for day in [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18,19,20,23,26,27,28,30]:
    dia = datos[datos['Fecha'] == "2019-06-"+(f"{day:02d}")]
    dia_lst.append(f"2019-06-{day:02d}") # <=========================== Here
    tiempo= pd.to_datetime(dia['Hora'], format=' %H:%M:%S').dt.time
    temp= dia['TEMP']
    plt.plot(tiempo, temp) #, color = 'red' )# 

plt.xlabel("Tiempo (H:M:S)(Formato 24 Horas)")
plt.ylabel("Temperatura (K)")
plt.title("Temperatura Jun 2019")
plt.legend(dia_lst) # <================================================ Here 
plt.show()
imagen.savefig('TEMPJUN2019')

看来你的数据['Fecha']只包含一个日期,这就是你应该根据需要更新的日期。