My Dataframe looks like:
product=c("p1","p1","p1","p2","p2","p2","p3","p3","p3")
varX=c(1,2,3)
var1=c(1,1,2,3,4,5,3,2,1)
var2=c(10,11,10,8,8,8,5,6,8)
da <- data.frame(varX, product, var1, var2)
ggplot(da, aes(varX)) + geom_line(aes(y = var1, colour = product)) + geom_line(aes(y = var2, colour = product))
Doing this leads to a plot with 6 lines where 2 are always the same colour. What I actually need is 6 different colours and the legend like.
-- p1(var1)
-- p1(var2)
-- p2(var1)
-- p2(var2)
-- p3(var1)
-- p3(var2)
And also a regression for var1 and var2 (distinct) would be nice to have in the same plot.