I am plotting some data series along with regression lines using this code:
ggplot(dt1.melt, aes(x=lower, y=value, group=variable, colour=variable)) +
geom_point(shape=1) +
geom_smooth(method=lm,
se=FALSE)
However, I need to constrain the regression line to be through the origin for all series – in the same way as abline(lm(Q75~-1+lower,data=dt1)) would achieve on a standard R plot.
Can anyone explain how to do this in ggplot ?
You need to specify this in the
formulaargument togeom_smooth: