I want to produce something like this (this is for Python): https://i.stack.imgur.com/QCpIF.png
but I want to do it for R. This is my code in R:
mean_delays_day <- aggregate(cbind(ArrDelay, DepDelay) ~ DayOfWeek, data = df, FUN = mean)
bestday <- ggplot(mean_delays_day, aes(x = DayOfWeek)) +
geom_bar(aes(y = ArrDelay, fill = "ArrDelay"), stat = "identity", width = 0.7, alpha = 1) +
geom_bar(aes(y = DepDelay, fill = "DepDelay"), stat = "identity", position = "dodge", width = 0.7, alpha = 0.3) +
scale_fill_manual(values = colors, name = "") +
labs(title = "Average Delay by Day of the Week", x = "Day of the Week", y = "Average Delay Time (min)") +
theme(plot.title = element_text(hjust = 0.5))
bestday
But the output is like this instead:
https://i.stack.imgur.com/rXPfM.png
Please help me, I'm still very much a beginner just trying to do an assignment for school.