我是 R 编程新手,如何在绘制直方图后添加第二个 y 轴以绘制 geom_line 这是绘制直方图和 geom_line 的代码,我该如何解决我的问题 我想添加一个可以考虑概率的第二个 ax y
library(ggplot2)
ggplot(x2, aes(x=X2, fill=as.factor(X1))) +
geom_histogram(alpha = 0.5,bins=100, position="dodge") +
geom_line(x2,mapping = aes(x = X2, y = probability))+
coord_cartesian(ylim = c(0, 150),xlim=c(0,20000000))+
xlab("Intensity")
谢谢