[R] barplot() using beside=TRUE and the density argument

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Wed Dec 1 11:46:51 CET 2004


Hi

I am using barplot() to draw some barplots, with a matrix as the data so
that multiple bars are drawn for each data point.  I want to use the
argument "beside=TRUE" to juxtapose the bars instead of stacking them.

If I execute:

barplot(data,names.arg=names,density=c(20,10),beside=FALSE)

I get the expected behaviour i.e. the bottom part of the column is
shaded 20 lines per inch, the top part 10 lines per inch.  However, if I
try:

barplot(data,names.arg=names,density=c(20,10),beside=TRUE)

I don't get what *I* would expect (which admittedly might be the wrong
thing!).  What happens is that the left bar for each data point is
shaded 20 lines per inch, and the right bar is not shaded at all.

Any help would be very much appreciated.

Mick




More information about the R-help mailing list