我正在使用 ggplot2 制作直方图:
geom_histogram(aes(x=...), y="..ncount../sum(..ncount..)")
我得到了错误:
Mapping a variable to y and also using stat="bin".
With stat="bin", it will attempt to set the y value to the count of cases in each group.
This can result in unexpected behavior and will not be allowed in a future version of ggplot2.
If you want y to represent counts of cases, use stat="bin" and don't map a variable to y.
If you want y to represent values in the data, use stat="identity".
See ?geom_bar for examples. (Deprecated; last used in version 0.9.2)
一般是什么原因造成的?我对错误感到困惑,因为我没有将变量映射到y
,只是直方图,x
并且希望直方图条的高度代表数据的归一化部分(这样所有条的高度总和为 100%数据。)
编辑:如果我想制作密度图geom_density
而不是geom_histogram
,我使用..ncount../sum(..ncount..)
or..scaled..
吗?我不清楚是做什么..scaled..
的。