materias = ["MAT 1","MAT 2","MAT 3","FIS 1","FIS 2","FIS 3","QUI 1","QUI 2","GEO 1","GEO 2","PORT","RED","LIT","ART","ING","HIST 1","HIST 2","FIL","SOC","EDF","BIO 1","BIO 2","BIO 3"
]
for i in materias:
note= str(i)
file_name = 'images/' + str(i) +'.png'
print(i,":")
plt.plot(df["PROVAS"], df[i], label=note)
plt.legend()
plt.savefig(file_name)
plt.show()
我不知道如何合并所有这些图形,也不知道如何给它们不同的颜色(以更好地可视化) (对不起我的英语不好)
只需将
c=(R, G, B)
添加到 plot()
调用中,其中 R
、G
和 B
是介于 0 和 1 之间的值。
例如,
colors = [(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)]
plt.plot(df["PROVAS"], df[i], c=colors[2], label=note)
将使线变为绿色。 对于您的示例,您可以跟踪索引并在浏览材料列表时逐步浏览颜色列表。