Let’s load some data.
library(ggplot2) library(dplyr)
mpg_summary <- mtcars %>% group_by(cyl) %>% summarise(avg_mpg = mean(mpg))
ggplot(mpg_summary, aes(x = factor(cyl), y = avg_mpg, fill = factor(cyl))) + geom_bar(stat = “identity”) + labs(title = “Average MPG by Cylinder Count”, x = “Number of Cylinders”, y = “Average MPG”) + scale_fill_manual(values = c(“#36A2EB”, “#FF6384”, “#FFCE56”)) + theme_minimal() + theme(legend.position = “none”)