There are a couple of different options that you can try (each generalize a bit differently to other situations).
If you just want lines at the tick marks to go the entire width (and be generated automatically to match the labels), then look at ?par and look at 'tck', you can use this in the barplot call, or in a call to axis after the fact. If you want the bars on top then just issue another call to barplot with add=T. See abline and the h= option for drawing lines across the entire width. See par and the 'usr' entry for how to find the user coordinates of the edges of the plot (for adding lines by hand). See the cnvrt.coords function in the TeachingDemos package for more general conversions between coordinate systems (you can use this to draw a line from half way across to the edge, or other aritrary locations, probably overkill for your problem). The return value for barplot gives the center positions of the bars (the heights match the data you input to barplot), see the first example in the help for barplot. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of justin rapp Sent: Saturday, July 08, 2006 1:05 PM To: [email protected] Subject: [R] Adding Lines to Plot This seems like a question that I should be able to answer on my own but after looking at the documentation I cannot seem to find the correct method. How do I add lines to a bar plot that extend from the vertical axis? For example, my vertical axis is numbered in increments of 10 and I would like these to go across the whole graph. Also, is there a way to have R label the value of each bar so that I know the value of each factor that is being plotted? Thanks in advance. jdr ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
