[R] For two vectors, how to plot bin-to-bin histogram comparision in R?

arun smartpink111 at yahoo.com
Sat Feb 15 04:30:51 CET 2014


Hi,
Try ?multhist() from library(plotrix)
set.seed(49)
 vec1 <- rnorm(1e4,0,0.5)
 set.seed(9453)
 vec2 <- rnorm(1e4,0,0.5)
library(plotrix)
multhist(list(vec1,vec2))
A.K.





I've met a problem recently. Have you ever been met a plot like the belowing? 



In
 this picture, as you see, the solid black bars represent one vector 
(named as vector A), and the empty bars represent the other vector 
(named as vector B). I know how to plot two histogram together in one 
picture. however, I don't know how to draw and compare them in 
bin-to-bin form just like the above picture. Did anybody know how to 
plot this in R?



More information about the R-help mailing list