我需要在我的兩個地塊的頂部添加兩條線(最適合線和45度線)的圖例。對不起,我不知道如何添加劇情!請請幫助我,我真的很感激它!如何添加兩條不同線R的ggplot圖例?
下面是一個例子
type=factor(rep(c("A","B","C"),5))
xvariable=seq(1,15)
yvariable=2*xvariable+rnorm(15,0,2)
newdata=data.frame(type,xvariable,yvariable)
p = ggplot(newdata,aes(x=xvariable,y=yvariable))
p+geom_point(size=3)+ facet_wrap(~ type) +
geom_abline(intercept =0, slope =1,color="red",size=1)+
stat_smooth(method="lm", se=FALSE,size=1)
謝謝你這麼這麼這麼這麼這麼多!!!!!你救了我的命! – user2844018