Yes that's what I did but in some instance I have an unknown number which truthfully it gets so messy that I still need to figure out how to filter the data again. I managed to use RcolorBrewer to have 8 different colors. But I will take a look at what you linked. Thanks very much your help has solved something which has been bothering me for a while now.
library(ggplot2)
library(RColorBrewer)
a <- c("1234","1234","1234","1234","1234","1234","1234","1234","1234",
"1256","1256","1256","1256","1256","1256","1256","1256","1256")
b <- c("21-Jun-21","21-Jun-21","21-Jun-21","22-Jun-21","22-Jun-21","22-Jun-21","23-Jun-21","23-Jun-21","23-Jun-21",
"21-Jun-21","21-Jun-21","21-Jun-21","22-Jun-21","22-Jun-21","22-Jun-21","23-Jun-21","23-Jun-21","23-Jun-21")
c <- c(0.2,0.3,0.5,0.02,0.05,0.04,0.08,0.09,0.1,0.7,0.02,0.3,0.1,0.05,0.06,0.1,0.5,0.9)
d <- c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)
e <- paste(a,b)
df <- data.frame(a,b,c,d,e)
cols <- brewer.pal(n = 8, name = "Dark2")[match(df$a,unique(df$a))]
names(cols) <- df$e
p <- ggplot(data=df, aes(x=d, y=c, colour=e)) + geom_line()
p + scale_colour_manual(values = cols) +
labs(colour="legend")