here is my code to plot density on the histogram using geom_density(bw = "SJ")
but the line does not appear on the plot.
How can I fix it?
df %>%
ggplot(aes(x=age, fill = as.factor(general_status)))+
geom_histogram(
bins = nclass.Sturges(age))+
geom_density(bw = "SJ")+
facet_grid(~general_status)+
geom_vline(data = status_means, aes(xintercept = avg), color="black", linetype="dashed")+
geom_text(data = status_means , aes(x = avg, label = avg), y= Inf, vjust = 2, hjust = -0.1 )+
ggtitle("Company age distribution by \nstatus") +
coord_cartesian(ylim=c(0, 350000)) +
scale_y_continuous(breaks=seq(0, 350000, 50000))+
scale_fill_manual(values = c("Active" = "springgreen4", "Failed" = "firebrick3"))+
theme(legend.position="None", strip.background = element_rect(colour="black",
fill="white"))