I want to create a density curve with individual dots.
The model is from this manuscript:
I have found a few tutorials, and also one nice package (ggridges) to plot this.
Here is my result. However, this package does only work with a y-value (e.g. 2 categories), but does not work if I just want to plot it for a single gorup.
My questions are:
- Can I plot single density curves using the ggridges package? I do not want multiple behind each other.
- Can I plot an ordinary density curve using ggplot2 including a jitter plot for individual dots?
Thank you very much
# dataframe set.seed(1234) df <- data.frame( sex=factor(rep(c("F", "M"), each=200)), weight=round(c(rnorm(200, mean=55, sd=5), rnorm(200, mean=65, sd=5))) ) # Packages library(ggplot2) library(ggridges) ggplot(df, aes(x = weight, y = sex)) + geom_density_ridges(jittered_points = TRUE)