虽然使用了alpha,但ggplot2不透明

时间:2018-04-20 07:24:36

标签: r ggplot2

我有两个不同的数据框,我想在ggplot2中重叠:

plot3<- ggplot(fit3f, aes(x=exp(exp(.fitted)), y=.resid)) + 
  ggtitle("data points: 3") +
  xlab("Amplification") + ylab("res. pear.") +
  geom_point(colour="dodgerblue4") +
  # ylim(c(0,1)) +
  geom_vline(xintercept=150, linetype="dashed", colour="orange", size=2) + 
  geom_point(data=fit3f_not_irr, aes(exp(exp(.fitted)), y=.resid, alpha = 0.05, colour="firebrick4"), show.legend  = FALSE)

但是,它不透明。那是为什么?

Plot

1 个答案:

答案 0 :(得分:2)

alpha = 0.05进入了aes(...) - 函数调用。试试这个:

geom_point(data=fit3f_not_irr, aes(exp(exp(.fitted)), 
                               y=.resid, 
                               colour="firebrick4"),
       alpha = 0.05, 
       show.legend  = FALSE)