Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix geom_violin(position = "dodge2") #6663

Open
@teunbrand

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /