I know that this was asked before, but I don't get why my approach is wrong. As illustrated in the graph, the line representing "Occupational mean college rate" is blue, but not dashed in the legend. This seems weird to me as I am following the same approach for the scale colour and the scale linetype.
Here my code:
over_time_both <- ggplot() + geom_smooth(data = coll_wage_ot, aes(x= acc_sum.x, y= final.x, group = 1, color="Occupational mean college rate"), method = "loess", formula = y ~ x,
se=F, linetype = 2) +
geom_smooth(data = coll_wage_ot, aes(x= acc_sum.y, y= final.y, group = 1, color="Occupational mean wage"), method = "loess", formula = y ~ x, se=F, linetype = 1) +
ggtitle("") + theme(plot.title = element_text(size=12), legend.position= c(.5, .9)) +
scale_color_manual(name = "Type of Ranking",
labels = c("Occupational mean college rate", "Occupational mean wage"),
values = c("blue", "red"))+
scale_linetype_manual(name = "Type of Ranking",
labels = c("Occupational mean college rate", "Occupational mean wage"),
values = c("Occupational mean college rate" = 2, "Occupational mean wage" = 1))
print(over_time_both + theme(axis.text.x=element_text(angle = 60, hjust = 1)) +
labs(y="100 x Change in Employment Share", x = " Skill percentile"))
Many thanks in advance!