arun
2014-Feb-15 03:30 UTC
[R] For two vectors, how to plot bin-to-bin histogram comparision in R?
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?
Bert Gunter
2014-Feb-15 07:55 UTC
[R] For two vectors, how to plot bin-to-bin histogram comparision in R?
Of course the OP failed to note that no pictures can come through... But anyway, Do not do this! It can be highly misleading (due to arbitrariness of binning). See ?qqplot for a much better way to compare distributions.(alas, rarely used except by statisticians) -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Fri, Feb 14, 2014 at 7:30 PM, arun <smartpink111 at yahoo.com> wrote:> 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? > > ______________________________________________ > 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.