[R] how to add mean value to regression line using ggplot?

autumnlin jialincau at gmail.com
Thu Oct 18 20:50:56 CEST 2012

I have generated plot using ggplot, and i would like to add mean value to the
regression line as a marker. how to do it?

p <- ggplot(data, aes(x = x, y = y, 
                          color = a, shape = factor(sex), 
                          linetype = factor(sex))) 

p0 <- p + 
  scale_color_manual(values=c("#00FFFF", "#FFFF00", "#00FF00")) +
  geom_smooth(method = "lm", se = FALSE, size = 1.5) 

Thanks a lot.

View this message in context: http://r.789695.n4.nabble.com/how-to-add-mean-value-to-regression-line-using-ggplot-tp4646674.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list