Skip to content
Prev 384025 / 398502 Next

how to show percentage of individuals for two groups on histogram?

Hi Eric,

Thank you for getting back to me, I tried those solutions but they
don't do percentage per groups, so if I do
ggplot(data=subset(a, !is.na(pheno)), aes(x=HBA1C, fill=pheno)) +
geom_histogram(aes(y =

stat(density)), binwidth = 0.5) +
  scale_y_continuous(labels = scales::percent_format())

I am getting the plot in attach, while my results should be more in
this range like on the plot here:
https://www.ncbi.nlm.nih.gov/projects/gap/cgi-bin/variable.cgi?study_id=phs000018.v2.p1&phv=19980&phd=154&pha=2864&pht=62&phvf=&phdf=&phaf=&phtf=&dssp=1&consent=&temp=1
On Fri, May 22, 2020 at 12:18 AM Eric Berger <ericjberger at gmail.com> wrote:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2020-05-22 at 9.42.21 AM.png
Type: image/png
Size: 57079 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200522/ad5e1814/attachment.png>