[R] is it possible to combine multiple barplots?

Ben Bolker bolker at ufl.edu
Wed Jun 10 19:08:18 CEST 2009




philipp schmidt-3 wrote:
> 
> i am working with two sets of likert scale type (4 distinct values) data:
> 
> dataA <- rep(1:4, c(3,2,2,4))
> dataB <- rep(1:4, c(5,4,3,2))
> 
> i can now (bar)plot both of these separately and compare the
> distributions.
> 
> plot(table(dataA), type='h')
> plot(table(dataB), type='h')
> 
> is there a way to plot both of them in one plot, so that the bars for
> value "1" (dataA: 3, dataB: 5) would appear side by side, followed by
> the bars for value 2 etc.?
> 
> 

barplot(rbind(table(dataA),table(dataB)),beside=TRUE)

or see plotrix::multhist

-- 
View this message in context: http://www.nabble.com/is-it-possible-to-combine-multiple-barplots--tp23943970p23966848.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list