【发布时间】:2014-02-19 20:18:59
【问题描述】:
我用 ggplot2 创建了这个直方图:
x = rnorm(100,0,150)
df <- data.frame(val=c(x))
ggplot(df, aes(val,..density.., fill = ..x..>100)) +
geom_histogram(binwidth=bw.SJ(df$val), colour="black") +
scale_fill_hue(h=c(115,230))
我想将 pdf 添加到此直方图中,但是当添加下一行时:
geom_density(colour="red", lwd=1) +
这会返回错误:
Error in get(x, envir = this, inherits = inh)(this, ...) :
Aesthetics can not vary with a ribbon
提前致谢!
【问题讨论】: