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.
1 Answer 1
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.
answered Feb 16, 2013 at 17:52
Ben Bolker
230k2626 gold badges405405 silver badges497497 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
This question is in a collective: a subcommunity defined by tags with relevant content and experts.
- The Overflow Blog
-
-
- Featured on Meta
-
-
-
Related
Hot Network Questions
- Basic questions about starting an individual PhD in Germany that I haven't found answers to
- Stacking of Shield spell when used with Enspelled Armor
- Is Brian Ripley’s Pattern Recognition and NN book still an insightful read?
- What is an Undercover Word™?
- Can a number have the same digit sum and digit product?
- Visiting UK with a valid visa but a soon-expiring passport
- Find the integral over a unit disk
- Should I standardize or only center "Age" in an ordinal semiparametric regression model?
- Prove that triangle BNC is isosceles in a 30-60-90 construction
- At what speed does a pulse propagate in a conducting wire?
- How to execute machine code in QuickBasic under DosBox?
- Why is Sophocles's play typically known by a Latin title?
- Is non-gavage fois gras available in France?
- How do I roleplay when given a mechanics prompt?
- Why am I getting this message, and how do I fix it?
- PSE Advent Calendar 2025 (Day 2): Decorating in the Midst of Purple Skies
- Fuel governer fail
- Where can I get another Lightscale Trident (or is it impossible to get another one)?
- Launch container on first connection
- Stochastic order of generalized chi-square distributions
- How reliable is the Ethiopian E-Visa or the visa-on-arrival?
- Is there a standard for distance between outdoor outlets?
- How to solder/desolder components on a 3mm aluminum-backed PCB?
- Incorrect (but reasonable) employment dates on CV for PhD application
lang-r
geom_abline(), e.g.geom_abline(aes(intercept=a,slope=b))... see?geom_abline