1

I want to create a scatterplot in ggplot2 with one or more lines over-layed. Having looked at the documentation for geom_smooth() and geom_line(), it remains unclear to me how I can specify the equations for lines that I want to add to a plot. I understand that this must be very basic, so please feel free simply to point me toward the appropriate documentation that I must have overlooked.

3
  • geom_abline(), e.g. geom_abline(aes(intercept=a,slope=b)) ... see ?geom_abline Commented Feb 16, 2013 at 17:42
  • The documentation seems to provide some examples: docs.ggplot2.org/0.9.3/geom_smooth.html Commented Feb 16, 2013 at 17:42
  • @BenBolker: Make that a solution and I'll accept it. Thanks! Commented Feb 16, 2013 at 17:48

1 Answer 1

5

geom_abline() is the name of the geom you're looking for, e.g. geom_abline(aes(intercept=a,slope=b)). There are examples in the online documentation.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.