# Load data
data("mtcars")
df <- mtcars
df$cyl <- as.factor(df$cyl)
# Scatter plot with ellipses and group mean points
ggscatter(df, x = "wt", y = "mpg", color = "cyl", ellipse = TRUE)+
stat_mean(aes(color = cyl, shape = cyl))
Run the code above in your browser using DataLab