On Wed, 2006-03-01 at 12:01 -0500, Jamieson Cobleigh wrote: > I'm using barplot2 to plot some data. Is there any way to determine > the width of the bars in the generated plot? I know that barplot2 > returns a list of the coordinates of the center of each bar, but since > there is some white space between each bar, I don't know how to get > the width of each bar. > > Jamie
Unless you have modified the 'width' argument, the default width is 1. Thus the sides of the bars are the centers +/- 0.5. If you modified the width argument, then the widths are set to the vector assigned. This behavior is the same in barplot() and barplot2() by design. As an example: # Draw a barplot. adjust the y axis to make some room # above the bars mp <- barplot2(1:10, ylim = c(0, 12)) # Draw lines showing the bar width limits arrows(mp - 0.5, 2:11, mp + 0.5, 2:11, angle = 90, code = 3) HTH, Marc Schwartz ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html