我尝试过par(new=T)
,保持比例,限制和标签不变
错误消息:
ggplot(data = s1, aes(x = IVAR, y = DV))+
stat_summary(geom="ribbon", fun.data=mean_cl_normal,
fun.args=list(conf.int=0.95), fill="lightblue")+
stat_summary(geom="line", fun.y=mean, linetype=1,color="red",size=1)+ theme_light()+xlim(0,168) #data to show simulations with the CI band
par(new=T)
ggplot(data = s2, aes(x = IVAR, y = DV))+xlim(0,168)
par(new=F)
答案 0 :(得分:1)
a <- data.frame(x = 1:10, y = 2:11)
b <- data.frame(j = sample(1:100, 10), k = sample(1:100, 10))
ggplot(a, aes(x, y))+
geom_point(color = "red")+
geom_point(data = b,
aes(x = j, y = k),
color = "steelblue")
第二个geom_point
调用的关键是data =
部分。