[R] Overlaying Barplots

Martyn Plummer plummer at iarc.fr
Wed Jun 8 14:28:45 CEST 2005


On Wed, 2005-06-08 at 12:07 +0200, Sven C. Koehler wrote:
> Hello!
> 
> I would like to overlay barplot(1:10) with a barplot(seq(1:5, each=2)),
> indicating that 50% of each bar belongs to category X.  How do I do this
> in R?

If you pass a matrix to barplot, it will stack values from the same
column on top of each other. So something like

barplot(rbind(1:10, 1:10))

will do what you want.




More information about the R-help mailing list