Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in jitter.width of geom_point() since v3.5.1.9000 #6300

Open
jbengler opened this issue Jan 22, 2025 · 1 comment
Open

Changes in jitter.width of geom_point() since v3.5.1.9000 #6300

jbengler opened this issue Jan 22, 2025 · 1 comment

Comments

@jbengler
Copy link

Part 1

In this example the jitter is wider since v3.5.1.9000

ggplot(mtcars, aes(x = factor(cyl), y = disp, color = factor(cyl))) +
  geom_point(
    position = position_jitterdodge(
      jitter.width = 0.4, jitter.height = 0, dodge.width = 0, seed = 42
      )
    )

Output of ggplot2 v3.5.1

Image

Output of ggplot2 v3.5.1.9000

Image

Part 2

Now, it gets even more interesting. If the grouping viable is discrete, but not a factor, the jitter is more narrow since v3.5.1.9000

mtcars %>%
  mutate(new_var = c(rep("A", 11), rep("B", 11), rep("C", 10))) %>%
  ggplot(aes(x = new_var, y = disp, color = new_var)) +
  geom_point(
    position = position_jitterdodge(
      jitter.width = 0.4, jitter.height = 0, dodge.width = 0, seed = 42
    )
  )

Output of ggplot2 v3.5.1

Image

Output of ggplot2 v3.5.1.9000

Image

Conclusion

I am not sure what to make of this. I guess this might probably not hurt too much. However, in tidyplots it triggers a lot of vdiffr failures.

@teunbrand
Copy link
Collaborator

Thanks for the report Jan!

The relevant PR that affected this behaviour is #5922.
In the dev version, the jitter is equally wide regardless of whether the grouping is a factor or character.
The behaviour in 3.5.1, where you get unequal jitter widths based on factor/character, is undesirable.

it triggers a lot of vdiffr failures

I'm sure there will be other changes that will trigger small changes as well. vdiffr snapshots aren't checked on CRAN, so it won't be an immediate problem.

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

No branches or pull requests

2 participants