Hi, I have a following problem. I plot two lines using ggplot package - density plot and standard curve. See my code bellow:
ggplot(as.data.frame(resid(RegreseT)), aes(x=resid(RegreseT) )) +
geom_density(alpha=.2 , color = "darkblue") +
stat_function(fun = dnorm, args = list(mean = mean(resid(RegreseT)), sd = sd(resid(RegreseT))) , colour = "red") +
xlab("Residuals of Temperature ~ Year_Month")+ylab("Density") +
labs(colour="I need a legend!!!!") +
theme(legend.key.height=unit(2, "cm"))
However, there is no legend in the output. Why, please? Thanks a lot.