I have two histograms on the same plot, but don't know how to change my y axis to percentage

Viewed 34

Here is my code:

ggplot() +   labs(x = "Age", 
       y = 'Frequency', 
       title = "Histogram comparison between real and synthetic data") + 
  geom_histogram(aes(r_data)) + 
  stat_function(fun = dnorm, 
                geom = "area", 
                color = 'white',
                fill = "lightgrey", 
                alpha = 0.2) + 
  geom_histogram(aes(region_sum_stats$mean_age), 
                 color = 'white', 
                 fill = 'steelblue', 
                 alpha = 0.8)

These are the histograms:

enter image description here

I'd love some help on this!

Thanks in advance!

0 Answers
Related