[R] Plotting coloured histograms...

Fernando Henrique Ferraz Pereira da Rosa mentus at gmx.de
Sat Jan 25 22:22:02 CET 2003


   Hi, I am having some trouble trying to plot a histogram in more than one
colour. What I want to do is, plot two vectors in the same histogram, but
with different colours, for instance:
       > x <- rnorm(1000,20,4);
       > y <- rnorm(1000,10,2);
    Then I'd like to have x and y ploted on the same hist (I can do that
already doing w <- c(x,y) then hist(w)) but the bars representing the x's should
be in one colour and the bars representing the y should be in another one,
so that I could see the overlaping areas of the two distributions etc.
     Is there any way to do that? I've read through the hist docummentation
(>help(hist)) and also googled for "R colour histogram" but didn't find
anything helpfull.

Thank you for your attention,

--




More information about the R-help mailing list