#activate the package library(ggplot2) #load the dataframe ID <- 1:400 values <- c(rnorm(200, mean=50, sd=22), rnorm(200, mean=20, sd=10)) class <- c(rep("first", 200), rep("second",200)) my.dataframe <- data.frame(ID, values, class) #violin plot ggplot(my.dataframe, aes(class, values)) + geom_violin() #untrimmed violin plot ggplot(my.dataframe, aes(class, values)) + geom_violin(trim=FALSE) #untrimmed violin plot with 2 colors and the legend ggplot(my.dataframe, aes(class, values, fill=class)) + geom_violin(trim=FALSE) #untrimmed violin plot with 2 colors, boxplots and the legend ggplot(my.dataframe, aes(class, values, fill=class)) + geom_violin(trim=FALSE) + geom_boxplot(width=0.1, fill="yellow")