Based on previous ggplot post boxes with scatter overlay (same variables) ,
I would like to have one square for each day of the week instead of two boxes , and dots with a different color are scattered on it.
The code will look like this:
#Box-plot for day of week effect
plot1<-ggplot(data=dodgers, aes(x=ordered_day_of_week, y=Attend)) + geom_boxplot()
#Scatter with specific colors for day of week
plot2<-ggplot(dodgers, aes(x=ordered_month, y=Attend, colour=Bobblehead, size=1.5)) + geom_point()
#Box-ploy with Scatter plot overlay
plot3<-ggplot(data=dodgers, aes(x=ordered_day_of_week, y=Attend, colour=Bobblehead)) + geom_boxplot() + geom_point()
And the result will be:
1, scatter plot

2, drawer section

3, combined chart

source
share