Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Facetting leads to faulty x values for position_dodge(preserve="single") #2153

Closed
has2k1 opened this Issue Jun 9, 2017 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

has2k1 commented Jun 9, 2017

library(ggplot2)

ggplot(mtcars, aes(factor(cyl), fill=factor(vs))) +
  geom_bar(position=position_dodge(preserve = "single")) +
  facet_wrap(~ am)

The width of the bars is wrong. The problem is here..

@has2k1 has2k1 added a commit to has2k1/ggplot2 that referenced this issue Jun 9, 2017

@has2k1 has2k1 Fix position_dodge
When calculating the groups in a bin, do it per panel then get the
maximum across all panel.

fixes #2153
702422f

@has2k1 has2k1 added a commit to has2k1/ggplot2 that referenced this issue Jun 15, 2017

@has2k1 has2k1 Fix position_dodge
When calculating the groups in a bin, do it per panel then get the
maximum across all panel.

fixes #2153
3ea5881
Collaborator

karawoo commented Aug 1, 2017

The new position_dodge2() function improves this by centering each group of bars (or boxes, etc.) at their x position.

karawoo closed this Aug 1, 2017

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