[R] Plotting coloured histograms...

Remigijus Lapinskas remigijus.lapinskas at maf.vu.lt
Sun Jan 26 08:28:03 CET 2003


Try the H. Bengtsson's function plot.histogram from

http://www.maths.lth.se/matstat/staff/hb/mypackages/R/plot.histogram.R

Remigijus

Saturday, January 25, 2003, 10:21:30 PM, you wrote:

FHFPdR>    Hi, I am having some trouble trying to plot a histogram in more than one
FHFPdR> colour. What I want to do is, plot two vectors in the same histogram, but
FHFPdR> with different colours, for instance:
FHFPdR>        > x <- rnorm(1000,20,4);
FHFPdR>        > y <- rnorm(1000,10,2);
FHFPdR>     Then I'd like to have x and y ploted on the same hist (I can do that
FHFPdR> already doing w <- c(x,y) then hist(w)) but the bars representing the x's should
FHFPdR> be in one colour and the bars representing the y should be in another one,
FHFPdR> so that I could see the overlaping areas of the two distributions etc.
FHFPdR>      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
FHFPdR> anything helpfull.

FHFPdR> Thank you for your attention,

FHFPdR> --

FHFPdR> ______________________________________________
FHFPdR> R-help at stat.math.ethz.ch mailing list
FHFPdR> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list