GGPLOT中如何挖掘隐埋回归线 [英] How to Unearth the Buried Regression Line in GGPLOT
本文介绍了GGPLOT中如何挖掘隐埋回归线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
回归线被深埋。
有没有什么办法可以在这里修改我的代码,在点上显示它?
我知道我可以增加大小,但它仍然在点之下。
p < - ggplot(data = my_df,aes(x = x,y = y),)+
xlab(x)+
ylab(y)+
geom_smooth(method =lm,se = FALSE,color =red,formula = y〜x,size = 1.5)+
geom_point()
p
p < - ggplot( data = my_df,aes(x = x,y = y),)+
xlab(x)+
ylab(y)+
geom_point()+
geom_smooth(method =lm,se = FALSE,color =red,formula = y〜x,size = 1.5)
p
Currently my regression plot looks like this. Notice that the regression line is deeply buried.
Is there any way I can modify my code here, to show it on top of the dots? I know I can increase the size but it's still underneath the dots.
p <- ggplot(data=my_df, aes(x=x,y=y),) +
xlab("x") +
ylab("y")+
geom_smooth(method="lm",se=FALSE,color="red",formula=y~x,size=1.5) +
geom_point()
p
解决方案
Just change the order:
p <- ggplot(data=my_df, aes(x=x,y=y),) +
xlab("x") +
ylab("y")+
geom_point() +
geom_smooth(method="lm",se=FALSE,color="red",formula=y~x,size=1.5)
p
这篇关于GGPLOT中如何挖掘隐埋回归线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文