library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
data <- mtcarsdata$cyl <- as.factor(data$cyl)ggplot(data, aes(x = cyl,y = mpg, fill = cyl))+
geom_violin(trim = FALSE ) +
labs(
title = "Violin plot of miles per gallon by no of cylinders",
x = "no of cylinders",
y = "miles per gallon"
) +
theme_minimal()