Histograms and Density Plots in ggplot2
Now you will learn the ggplot2 syntax for building and customizing histograms.
Use facets
Split the plot into multiple panels :
p<-ggplot(df, aes(x=weight))+ geom_histogram(color="black", fill="white")+ facet_grid(sex ~ .) p # Add mean lines p+geom_vline(data=mu, aes(xintercept=grp.mean, color="red"), linetype="dashed")