How to Draw Horizontal and Vertical Lines in R
Example
1. abline(h=0)
Draws a horizontal line.
2. abline(v=0)
Draws a vertical line.
3. abline(0,3/4)
Draws a line with an intercept of and a slope of .
Originally, the abline()
function is named after , which are the coefficients of . If you’re using R for statistics, you probably won’t find much use for it outside of drawing regression lines.
segments(4,0,4,3)
Draws a line segment from to . Useful when you want to draw only the necessary parts cleanly.