I have a dataframe and want to loop through all columns and add a new line to a chart, with a different colour.
This code does the trick.
variables=df.columns
colours=['b','y','r','c','k','m']
for i, j in zip(variables, colours):
plt.plot(df[i],j+'-o',label=i)
plt.ylim(ymin=0)
plt.gcf().set_size_inches((18, 5))
plt.legend().set_visible(True)
However a different dataframe might need more colours.
Is there a way to create a list of random colours?