Hi ,
I'm new to ggplot. It looks binwidth doens't work together with stat variable,
The following code works in R
ggplot(data=sip2)+geom_histogram(aes(x=KPI1.Achieved.Percentage),binwidth = 0.02)
However, it doesn't work when i add stat variable to the code.
ggplot(data=sip2)+geom_histogram(aes(x=KPI1.Achieved.Percentage),stat="density",binwidth = 0.01)
Warning message:
Ignoring unknown parameters: binwidth, bins, pad
Any reasons why binwidth doesn't work in the 2nd case?
Thanks!
It is true that stat_density does not have a binwidth. It does have a parameter for adjusting the bandwidth, called bw. The description of bw in the help file is
The smoothing bandwidth to be used. If numeric, the standard deviation of the smoothing kernel. If character, a rule to choose the bandwidth, as listed in stats::bw.nrd() .