[R] lines on plot

Sean Anderson sc2ander at xcskier.com
Thu May 20 22:27:39 CEST 2010


On 2010-05-20, at 2:38 PM, Anthony Lopez wrote:

> Is there an easier way to make this graph *without* having to specify all of
> the separate segment arguments at the end?
> ...
> axis(2,at=2:7,lab=c("2","3","4","5","6","7"))
> segments(0,2,2.3,2)
> segments(0,3,2.3,3)
> segments(0,4,2.3,4)
> segments(0,5,2.3,5)
> segments(0,6,2.3,6)
> segments(0,7,2.3,7)

abline(h = 2:7)

grid() is another option

also, axis(2, at = 2:7) is all you need

Sean



More information about the R-help mailing list