[R] barplot border width

Marc Schwartz marc_schwartz at comcast.net
Thu Sep 13 15:16:32 CEST 2007


On Wed, 2007-09-12 at 21:43 +0200, John Lande wrote:
> I need to increase the width of the border in a barplot, i checked both
> barplot, and barplot2, but cant find how to do it. how can I do?

If you are referring to the borders of the bars themselves, you can
adjust par("lwd") prior to calling barplot():

Compare:

  barplot(1:5)

Versus:

  par(lwd = 2)
  barplot(1:5)

See ?par

Note that this does not work when using "inline" pars, such as:

  barplot(1:5, lwd = 2)

This is because there is an internal function in both barplot() and
barplot2() called xyrect() that draws the bars. While the function
definition provides for "..." args, the actual function call does not
have a "..." argument. Hence the additional arguments such as 'lwd' are
not passed.

I'll make a note of that for barplot2() and post a RFE on r-devel for
barplot().

HTH,

Marc Schwartz



More information about the R-help mailing list