[R] multi-class histogram?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Sep 23 11:04:24 CEST 2005

Karin Lagesen <karin.lagesen at medisin.uio.no> writes:

> I am new to R, and I couldn't find the answers to my question in a faq. 
> This could however be because I didn't know what to look for...:)
> I have three classes of data, data for bacteria, archaea and eukaryotes. 
> I wish to display these in a histogram where all of the values are used 
> to calculate each column. But, I want each column split in three, where 
> the size of each coloured area represents the proportions of the values 
> in that column that comes from each of the three classes. Do you have 
> any tips on how I do this? 

Well, the thing is that a histogram tries to represent a probability
distribution on the line (it is a density estimator), and the thing
that you want does not; barplot() is better at this sort of job.

   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907

More information about the R-help mailing list