How do I use color in a geom_dotplot?

Viewed 4514

I have this dotplot:

ggplot(mpg, aes(drv, hwy)) +
  geom_dotplot(binwidth = 1, binaxis = 'y', stackdir = 'center')

which renders as

enter image description here

I want to color the dots by manufacturer. If I add a fill aesthetic:

ggplot(mpg, aes(drv, hwy, fill = manufacturer)) +
  geom_dotplot(binwidth = 1, binaxis = 'y', stackdir = 'center')

it renders as

enter image description here

It looks like adding color has defeated the stacking algorithm somehow, causing the dots to overlap. How do I fix this?

2 Answers
Related