I want to plot a probability histogram overlay with probability curve and compare them between two group. my code is as following,
ggplot(MDmedianall, aes(x= MD_median, y=..density.., fill =IDH.type )) +
geom_histogram(alpha = 0.5,binwidth = 0.00010, position = 'identity') +
geom_density( stat="density", position="identity", alpha=0.3 ) +
scale_fill_discrete(breaks=c("0","1"), labels=c("IDH wild type","IDH mutant type")) +
scale_y_continuous(labels = scales :: percent) +
ylab("Relative cumulative frequency(%)") +
xlab("MD median value")
However, the y axis is not what I want, any reasons for that? BTW, how to change the line style and label them within the color square on the right.