我试图将逻辑回归的组合图绘制为函数logi.hist.plot,但我想使用ggplot2(美学原因)来做.
问题是只有一个直方图应该有scale_y_reverse().
有没有办法在单个图中指定它(参见下面的代码)或者使用可以传递给上一个图的坐标来重叠两个直方图?
ggplot(dat) +
geom_point(aes(x=ind, y=dep)) +
stat_smooth(aes(x=ind, y=dep), method=glm, method.args=list(family="binomial"), se=FALSE) +
geom_histogram(data=dat[dat$dep==0,], aes(x=ind)) +
geom_histogram(data=dat[dat$dep==1,], aes(x=ind)) ## + scale_y_reverse()
Run Code Online (Sandbox Code Playgroud)
最后的情节是我一直在努力实现的:
