Equivalent of "xlim" or "ylim" for vertical/horizontal abline?
graphics, r
Solution
Use the `segments()` function, e.g.
plot(1:4,1:4,ylim=c(0,4))
abline(v=2)
segments(x0=2,y0=0,x1=2,y1=2,col="red")
Problem
I'm using the `abline` function in R to draw vertical lines on a plot. Is there a way I can restrict the extent of the line? For example, yf the Y axis goes from 0 to 4, can I plot just the portion from 0 to 2?