3.Histogram plots
3.1 Basic histogram plot
head(df2)## sex weight
## 1 F 49
## 2 F 56
## 3 F 60
## 4 F 43
## 5 F 57
## 6 F 58ggplot(df2, aes(x=weight)) + geom_histogram(binwidth=1)
3.2 Add mean line on a histogram plot
ggplot(df2, aes(x=weight)) +
geom_histogram(binwidth=1, color="black", fill="white") +
geom_vline(aes(xintercept=mean(weight)),color="black", linetype="dashed", size=0.5)
3.3 Change histogram plot fill colors

Last updated
Was this helpful?