1
我想绘制叠加直线的多组直方图,但我无法获得直方图的正确缩放比例。 例如:用叠加线绘制多组直方图ggplot
ggplot() + geom_histogram(data=df8,aes(x=log(Y),y=..density..),binwidth=0.15,colour='black') +
geom_line(data = as.data.frame(pdf8), aes(y=pdf8$f,x=pdf8$x), col = "black",size=1)+theme_bw()
产生正确的比例。但是当我尝试按组进行填充时,每个组分别缩放。
ggplot() + geom_histogram(data=df8,aes(x=log(Y),fill=vec8,y=..density..),binwidth=0.15,colour='black') +
geom_line(data = as.data.frame(pdf8), aes(y=pdf8$f,x=pdf8$x), col = "black",size=1)+theme_bw()
我怎么会缩放以黑线重叠在直方图和y轴密度?
您是否尝试更改位置参数?什么职位=闪避给你?另外,你确定你正在生成覆盖直方图吗?是更多的堆叠给我。尝试玩alpha参数来看到这一点。另外,http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example –