[R] Changing y-axis in ggplot to show proportions instead of density
Camilo Mora
cmora at DAL.CA
Wed Apr 3 21:15:22 CEST 2013
Hi Everyone,
I have a frequency data, which I am displaying with an area-curve-like
plot in ggplot2 using:
ggplot(dfs, aes(x=values)) + geom_density(aes(group=ind))
The Y-axis that is returned is density, which is not really intuitive
for my purposes and I would like to change it for proportions (i.e.
the count of values at each bin divided by the total number of values).
I have found that I can change the y-axis to display counts or scaled
proportions but not just the proportions.
something like +geom_density(aes(y = count/sum(count)))
This code does not work but I wonder if something like this possible?
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada you have to dial 011 57 313 776 2282
http://www.soc.hawaii.edu/mora/
More information about the R-help
mailing list