[R] Adding bars to the right of existing ones using barplot

Charilaos Skiadas skiadas at hanover.edu
Tue Mar 13 21:25:15 CET 2007


On Mar 13, 2007, at 3:34 PM, Jason Horn wrote:

> I'm trying to create a barplot that has two sets of data next to each
> other.  I'm using barplot with the add=TRUE option, but this simply
> adds the second dataset on top of the first, obscuring it.  How do I
> add the new data to the right on the existing barplot so that both
> sets are visible?  I've been playing with all sorts of option and
> reading the list archives with no luck.

Something like this?

a<-rnorm(3,2,1)
b<-rnorm(3,2,1)
barplot(rbind(a,b), beside=TRUE)


?barplot for more options ( in particular, the height argument)


> Thank you anyone who has the answer.
>
> - Jason

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College



More information about the R-help mailing list