How to add a diagonal line to a plot?

Junhua Zhao picture Junhua Zhao · Dec 14, 2014 · Viewed 37.7k times · Source

I want to add a diagonal line to the plot. It is not a linear regression line. I just want a diagnol line. Can anyone help me with this? Thanks a lot!

Answer

Lennert picture Lennert · Mar 29, 2017

If you want to add the 1:1 diagonal line:

qplot(1,1) + geom_abline(intercept = 0, slope = 1)