How to add straight lines through the current plot in R?

You can use the command abline in R. For example, you want add to the current plot a horizontal line at y=1, a vertial line at x=3, and a line with intercept 2 and slope 0.5. You can use the following command:

    abline(h=1)
    abline(v=3)
    abline(a=2, b=0.5)
FAQ Category