Join GitHub today
Actual result of ..ndensity.. does not match the documentation #2324
However, the latter is not the case. Instead,
If this is a bug, it looks like it could be fixed with a one line change to R/bin.R (which I'd be happy to submit as a pull request if you want). But if this is the intended behavior, perhaps the documentation could be made more clear.
library(ggplot2) standard_normal <- data.frame(X = rnorm(1E5, 0, 1)) # ..ndensity.. is ..count.. / max(..density..) # which is not "density, scaled to a maximum of 1" ggplot(standard_normal, aes(x = X)) + geom_freqpoly(aes(y = ..ndensity..), binwidth = 0.2, center = 0, size = 1.5, color = 'black') + geom_freqpoly(aes(y = ..count../max(..density..)), binwidth = 0.2, center = 0, size = 0, color = 'cyan')
In particular, the changes to R/stat-bin.r in this commit included removing the line:
while adding the line:
I assume the change from