[R] : put grids in a plot at specific x points

David Winsemius dwinsemius at comcast.net
Mon Mar 16 21:37:32 CET 2009

grid refers you to abline when"more fine tuning is required", i.e.  
when the situation is not a regular grid.


abline(v=286.16, lty="dotted")

If you had a vector, vec,  then this should do the trick:

abline(v=vec, lty="dotted")

David Winsemius
On Mar 16, 2009, at 4:25 PM, Laura Rodriguez Murillo wrote:

> Hi dear all!
> I wonder if anybody can help me with this:
> I have a plot:
> allchr <- read.table("allchrtog.txt", header=F)
>> attach(allchr)
>> names(allchr)
> [1] "V1" "V2" "V3" "V4"
>> plot(V1,V3, type="n")
>> lines(V1,V3)
> and I want to add grids to the plot but just at specific x points. So
> for example, the first would be at 286.16 in the x axis.
> Does anybody know how can I add these lines?
> Thank you so much!
> Laura
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list