dat<-as.data.frame(rexp(1000,0.2))
g <- ggplot(dat, aes(x = dat[,1]))
g + geom_histogram(alpha = 0.2, binwidth = 5, colour = "black") +
geom_line(stat = "bin", binwidth = 5, linewidth = 1)
I met the same problem. You define the stat = "bin" for geom_line. It will explain the caculation of geom_line as geom_histogram or geom_freqpoly.
Result: