[R] ggplot2: histogram with proportions (or %)

hadley wickham h.wickham at gmail.com
Thu Oct 30 15:19:40 CET 2008


On Thu, Oct 30, 2008 at 3:49 AM, ONKELINX, Thierry
<Thierry.ONKELINX at inbo.be> wrote:
> Dear Bernd,
>
> AFAIK you can only get counts, densitys, counts scale to a maximum of 1
> and likewise densitys. But you can alter the labels on the scales
> manually.

Well, a proportion is just the count divided by the total count, so
you should be able to do:

qplot(carat, ..count.. / sum(..count..), data=diamonds, geom="histogram")

but unfortunately a bug seems to have crept into the latest version
and this doesn't work.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list