I really like the way the ggplot2::geom_dotplot()
can nicely stack dots towards the middle of a category but I cannot seem to combine that with a fill color.
If you're open to a bit of a hacky solution just to get it how you want it to look... You can overwrite the fill command by simply providing it with a vector of color names:
tmpData$colorname <- rep(c('red','blue','blue'),2)
ggplot(tmpData, aes(x=x, y=y)) +
geom_dotplot(binaxis = "y", stackdir = "center", dotsize=4, fill=tmpData$colorname)
I think you have to add the argument position = "dodge"
:
ggplot(tmpData, aes(x = x, y = y, fill = fill,)) +
geom_dotplot(binaxis = "y", stackdir = "center", dotsize = 4, position = "dodge")