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

Reproducible example for position_jitter() not working #5875

Open
fkohrt opened this issue May 1, 2024 · 1 comment
Open

Reproducible example for position_jitter() not working #5875

fkohrt opened this issue May 1, 2024 · 1 comment
Labels
documentation tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@fkohrt
Copy link
Contributor

fkohrt commented May 1, 2024

It seems to me, the last of the examples of position_jitter() does not work as intended. In other words: The following code...

#' # Create a jitter object for reproducible jitter:
#' jitter <- position_jitter(width = 0.1, height = 0.1)
#' ggplot(mtcars, aes(am, vs)) +
#' geom_point(position = jitter) +
#' geom_point(position = jitter, color = "red", aes(am + 0.2, vs + 0.2))

...does not seem to simply shift the jittered points:

position_jitter-5

But maybe I misunderstood what the example is supposed to show?

@teunbrand
Copy link
Collaborator

teunbrand commented May 2, 2024

Thanks for pointing this out. The position adjustment should be constructed as follows jitter <- position_jitter(width = 0.1, height = 0.1, seed = 0) and then it does what it should. The example should be updated to reflect this.

@teunbrand teunbrand added documentation tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

2 participants