[R] Vertical Line on Plot

Peter Ehlers ehlers at math.ucalgary.ca
Thu May 25 20:30:52 CEST 2006


Barry Rowlingson wrote:
> Peter Lauren wrote:
> 
>>I was wondering what would be the best way to put a
>>vertical line on a graph made with plot().  I can get
>>an horizontal line by plotting a vector where every
>>element has the same value but it is not as clear how
>>a vertical line should be done.
>>
> 
> 
>   abline(v=42)
> 
> you can use it for horizontal lines too: abline(h=42) and several other 
> things. See help(abline) for details.
> 
> Barry
> 

I don't wish to discourage new R users from asking questions in
this forum, but this seems like a good time to remind new R users
of the existence of some _very_ useful documentation:

1. As has just recently been mentioned again by Berton Gunter
in his periodic reminder, there exists a nice, concise ref-card at
  http://www.rpad.org/Rpad/Rpad-refcard.pdf

This would have led to abline() almost immediately (page 3).

2. 'An Introduction to R' is installed with R. Again, it would
have quickly led to abline() (section 12.2).

The help pages are great when you know what function you need.
The above two documents (and others on CRAN) help one to discover
what function might be needed.

Peter Ehlers



More information about the R-help mailing list