-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Labels
Description
Absolutely horrifying, perhaps even more so after the quantiles were reworked:
library(ggplot2)
ggplot(mpg, aes(drv, displ, fill = factor(year))) +
geom_violin(position = position_dodge2())
Created on 2025-09-29 with reprex v2.1.1
@karawoo had described this many moons ago https://youtu.be/UGAuXyxdrvA?si=q9GH8ety6Xj1ak5t&t=986, but I couldn't find a related issue that kept this on the radar. This issue is that blip.
I think fundamentally position_dodge2()
doesn't know the relation between rows and groups. For many geoms, 1 row is one group, like geom_boxplot()
, but in others there is a many-to-one relationship, like geom_violin()
or perhaps geom_dotplot()
. I think the meat of the issue is how we can communicate this information between geom and position. The implementation at the position level worries me less.