Hey All,

I need to apply different regression lines to different group on my ggplot,
and here is the code I use:

qplot(x=Var1,y=Var2,data=df,color=SiteID,group=SiteID)+geom_point()+geom_smooth(method='lm',formula=log(y)~I(1/x),se=FALSE,size=2)

However the regression for different groups is as below:

AL1/AL2: log(y)~I(1/x)
AL3: log(y)~log(x)

How can I apply each regression equation on the same ggplot?

Also I have an issue that if I use the code above, the regression lines are
not overlapped on top of my data points.

Thanks for your help!
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to