[R] ggplot - adding regression lines

soon yi soon.yi at ymail.com
Wed Dec 12 19:12:38 CET 2012


Hi

I am using ggplot to overlay two regression lines on a scatter plot each
corresponding to a treatment group.

The default plot gives a different slope for each treatment group. However,
in some cases i want the lines to be parallel -ie no significant
interaction. 

My code:

ggplot(data=df,X,Y,colour=treatment) + geom_point() +
geom_smooth(method="lm")

I think i use the 'formula' option in geom_smooth but have been unable to
find a solution.

thanks for any advice.

sy




--
View this message in context: http://r.789695.n4.nabble.com/ggplot-adding-regression-lines-tp4652906.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list