I have the following ggplot and trying to add the legend and a geom_abline at median.
purple line is for 2013 prods and red is for 2014
This is what I did to generate the plot:
ggplot(prods[Year==2013,], aes(x = Date, y = Prod, group = SOM)) +
geom_line(lwd = 1.3, colour = "purple") +
ylab("Actual Productivity") + theme(axis.title.x=element_blank()) +
geom_line(data=prods[Year==2014,], aes(x = Date, y = Prod, group = SOM),lwd = 1.3, colour = "red") +
geom_abline(data = prods,h=median(Prod))+
scale_color_manual("Period", values = c("purple","red"), labels = c("2013","2014")) +
facet_wrap(~ SOM)
I am not getting any error but there is no legend nor abline is popping up on the image. Plot looks like
this:
any help would be highly appreciated.
regards,
As per aosmith's advice:
I did the following and was able to get the following plot:
Plot looks like this: