问题描述
我正在处理具有不同系列的数据集,我需要对所有系列进行线性回归。问题是我想将所有线性回归线的截距设置为零。我在网上搜索了很多,人们说使用公式=y~-1+x,但这对我的案例没有用。我要问的是在 Excel 中很容易做的事情,但是我用 ggplot 花了一整天的时间没有解决方案,这让我发疯。请帮忙!
这是我的代码:
timecourseindividualplot<- ggplot(timecourseindividual,aes(x=incubation.time,y=X..of.tracer.converted,col=Depth))+
geom_point(size=1.5)+
geom_smooth(method=lm,formula=y~-1+x,se=FALSE)+
stat_regline_equation(label.x.npc=0,aes(label =..rr.label..))+
theme(plot.margin=unit(c(.5,.5,.5),"cm"))+
labs(x="Incubation Time (d)",y="Percentage of Tracer Converted (%)")+
coord_cartesian(ylim=c(0,2),xlim=c(0.85,3))+
theme(axis.title = element_text(size=22),axis.text=element_text(size=18))+
theme(legend.position="None")+
scale_color_discrete(name="Depth(m)")
timecourseindividualplot``
这是我的数据的样子,因为深度不同,有不同的系列:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)