Skip to content

alignment problem with preserve = "single" and preserve = "total" #4350

@ThomasKraft

Description

@ThomasKraft

This issue is a follow-up on #2712 (comment).

The previously posted solution does not work when there are 3 grouping levels, in which case the geom_point and geom_boxplot layers no longer match up again.

Reprex:

mtcars2 <- bind_rows(mtcars, data.frame(gear = c(4,5), mpg = c(22, 19), am = c(2, 2)))
ggplot(mtcars2, aes(factor(gear), mpg, fill = factor(am))) + 
   geom_boxplot(position = position_dodge2(0.75, preserve = 'single')) +
   geom_point(position = position_dodge(0.75, preserve = 'total'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorpositions 🥇

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions