大家好,我與ggplot2很難過。直方圖ggplot2錯誤的頻率
我想要做一個直方圖來代表例子:性別(男性和女性= y)與癌症(C)5個年齡段(A = x)的百分比。
pp <- ggplot(data=base, aes(x=AGE, y=factor(C), fill=Sex)) +
geom_bar(aes(y = (..count..)/sum(..count..)))+
scale_fill_grey()+
theme_bw()
pp
我有直方圖,但頻率錯誤。 有人可以告訴我爲什麼?
我很難解決它我自己的問題。
在此先感謝 彼得
http://docs.ggplot2.org/current/geom_histogram.html – CMichael