4.Density plots
4.1 Basic density
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_density()
4.2 Add mean line on a density plot
ggplot(df2, aes(x=weight)) +
geom_density() +
geom_vline(aes(xintercept=mean(weight)), color="black", linetype="dashed", size=0.5)
4.3 Change density plot fill colors
4.3.1 Change fill colors

4.3.2 Change line colors

4.3.3 Combine histogram and density plots

Last updated