-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Make sure jitter is only calculated once #4403
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
Conversation
I'm not entirely sure yet this works in all edge cases. I believe A safer approach might be to use some actual x or y data columns as dummy data, if available, and then subtract them from the dummy data before applying the jitter. Get's very circuitous, though. |
Looks like a long time ago I came up with a different way to solve this issue. See if you like this approach: |
Yeah, I saw that. I still prefer to calculate one jitter value per dimension and apply that. You are right that we need to extract real values for it but that is trivial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I would flip the order in the intersect()
command to get x
if available.
intersect(c("xmin", "x", "y"), c("x", "xmin"))[1]
#> [1] "xmin"
intersect(c("x", "xmin"), c("xmin", "x", "y"))[1]
#> [1] "x"
Created on 2021-04-09 by the reprex package (v1.0.0)
Ah - good catch... I thought I was doing the right way🙈 |
* Follow #4403 * add test * add news bullet
Fix #2941
This PR changes the jitter position implementation to calculate a jitter once for
x
andy
and then apply that to all position aesthetics