Skip to content

Conversation

@teunbrand
Copy link
Collaborator

This PR aims to fix #6775.

Briefly, when order has duplicates, these were considered as 'separate' groups to be accommodated and contributed to the width computation. But because they overlap, the width computation can ignore duplicates.
This PR just counts order if available, and else counts group.

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

df <- data.frame(
  y = c(1, 3, 2),
  g = c("A", "B", "C"),
  o = c(1, 2, 2)
)

ggplot(df, aes("x", y, fill = g, order = o)) +
  geom_col(position = position_dodge(preserve = "single"))

Created on 2025-12-18 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

position_dodge() with order aesthetics for stacking and dodging

1 participant