On Jan 15, 2008 12:27 PM, Dieter Menne <[EMAIL PROTECTED]> wrote: > hadley wickham <h.wickham <at> gmail.com> writes: > > > qplot(vals, ..density.., data = data.frame.A, geom="histogram", facets > > = factor.1 ~ factor.2, binwidth = 1) + geom_density(data=data.frame.B) > > uhh.. how should I understand "y (?)=..density.."
Yes, that does require a little explanation. The .. tells ggplot the variable (density) is not in the original dataset, but is instead produce by the statistical transformation (stat_bin for the histogram and stat_density for the density plot). By default the histogram uses ..count.. (the raw count) while density uses ..density.., so y = ..density.. tells them both to use the same scale (you could also use y = ..count.. but count on a density is plot is a little less common) Hadley -- http://had.co.nz/ ______________________________________________ R-help@r-project.org 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.