I need help adding color to the two histograms produced using ggplot and facet_wrap
What am I missing:
ObesityDataSet_raw_and_data_sinthetic %>%
ggplot(aes(x=Height)) +
geom_histogram(bins = 14)+
facet_wrap(~Gender)
It would look like this

>Solution :
To add color to the histograms in ggplot and facet_wrap, you can use the fill argument in the geom_histogram function to specify the color for each histogram. Here’s an example code:
ObesityDataSet_raw_and_data_sinthetic %>%
ggplot(aes(x=Height, fill=Gender)) +
geom_histogram(bins = 14, alpha=0.5, position = "identity")+
facet_wrap(~Gender)