[R] barplot or maybe related?

Manuel Morales Manuel.A.Morales at williams.edu
Mon Feb 11 20:51:34 CET 2008


On Mon, 2008-02-11 at 09:31 -0800, questions? wrote:
> I have two distributions, represented by heights of several intervals.
> e.g. the distribution is partitioned into 10 segments, I have
> numbers(freq or counts) associated
> with each region in the format as:
> 
> 0.2  0.3
> 0.1  0.1
> .....
> 
> 0.01 0.02
> 
> 
> I want to plot the two distributions side by side in meaning that, for
> each region,the
> two bars(in barplot) from the two distribution are adjacent to each
> other.
> 
> If you do barplot(beside=T), the two distribution are plotted side by
> side, not interleaved.
> I was wondering there are ways to do what I want

Compare:
mat1 <- matrix(c(1:10), nrow=5, ncol=2)
mat2 <- t(mat1) # Transpose mat1

barplot(mat1, beside=TRUE)
barplot(mat2, beside=TRUE)

> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
http://mutualism.williams.edu



More information about the R-help mailing list