I have a data set that looks like this:
dene <- data.frame(length =
c(35,32,33,34,41,40,46,35,41,40,45,36,38,37,39,40,42,42,42,43,44),
sex=c(1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,2,2,2,2,2,2))

I would like to plot the density (frequency of occurrence) of each length
class but I want to have different colors for sex. I used the following:
library(sm)
sex.f<-factor(as.factor(dene$sex),levels=c(1,2),
labels=c("Males","Females"))
sm.density.compare(dene$length, dene$sex)
yet I want the sum of the areas under the two curves to be equal to 1, not
the sum of the area under each curve to be equal to 1.

I can plot the frequency using hist, but then I do not get the two colors
indicating the difference in sex.


hist(dene$length, freq=F, breaks=11)

any thoughts on how to approach this would be appreciated.

Thank you

	[[alternative HTML version deleted]]

