I would like to plot the spread of my data on top of a boxplot. I've managed so far to overlap a geom_boxplot()
with a geom_dotplot()
. However, I have many datapoints, with many overlapping. I would like to give some indication in my plot of where most values are. I thought geom_count would be able to help out. I have however not found a way to use it with multiple groups!
Here's my first attempt at the boxplot/dotplot:
ggplot(data_BDI, aes(x=time, y=BDI, fill=Groups)) +
geom_boxplot(position=position_dodge(0.8))+
geom_dotplot(binaxis='y', stackdir='center',
position=position_dodge(0.8),
dotsize=0.7) +
scale_fill_grey() + theme_classic()
Now I want to add the geom_count, which only gives a result per time, and not per group:
ggplot(data_BDI, aes(x=time, y=BDI, fill=Groups)) +
geom_boxplot(position=position_dodge(0.8))+
geom_dotplot(binaxis='y', stackdir='center',
position=position_dodge(0.8),
dotsize=0.7) +
scale_fill_grey() + theme_classic() +
geom_count(aes(x=time, y=BDI, group=Groups))
Anyway to make the different colored group-points different in size? Or any other method in displaying the overlap?