Alexandre Depire wrote: > Hello, > I have the following data: > Km Sex > 250 1 > 300 2 > 290 2 > 600 1 > 450 2 > 650 1 > ......... > > I would like to obtain one histogram where the data (or the part) of each > sex is visible, it is like cumulative histogram or spinogram. > To be more comprehensible, i would like to know if the following graph is > obtainable easily in R. It is the first graph on page 5 in the following > document http://jasp.ism.ac.jp/~nakanoj/workshop04/TalkII.pdf > Something like :
d <- data.frame( x = rnorm(100), sex = sample(c(1,2), replace=TRUE, size=100)) out <- hist(d$x, col="gray") hist(d$x[d$sex==2], col="red", add=T, breaks=out$breaks) legend("topleft", c("male","female") , fill=c("gray","red")) box() Cheers, Romain -- *mangosolutions* /data analysis that delivers/ Tel +44 1249 467 467 Fax +44 1249 467 468 ______________________________________________ R-help@stat.math.ethz.ch 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.