-
Notifications
You must be signed in to change notification settings - Fork 2.1k
point is misplaced if width = 0 is used in position_dodge2 with geom_point #4327
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
Comments
Thanks. So, maybe |
I think only To fix the bug need to rewrite a condition inside the find overlaps function. Here: Line 141 in 7ddb6d9
There are two solutions, I think the first one is better.
if (is.na(df$xmin[i]) || is.na(df$xmax[i - 1]) || df$xmin[i] > df$xmax[i - 1]) {
if (is.na(df$xmin[i]) || is.na(df$xmax[i - 1]) || df$xmin[i] > df$xmax[i - 1] ||
(df$xmin[i] == df$xmax[i - 1] && df$xmin[i] != df$xmax[i])) { |
I figured out that PR #4936 doesn't work correctly for one of the examples (diamonds) from the documentation. I have tested the second solution (#4327 (comment)). It fixed the new bug and the previous one. |
@javlon Could you just revert the change in a different PR (hopefully with a test, but it's optional)? Your first solution was simple enough so I thought it's worth adding, but now I'm not confident that there's no corner case that (I still think this should be solved by just making it error because dodging with zero width sounds meaningless...) |
If
position_dodge2(width = 0)
is used with theposition
argument ingeom_point()
(one?) is wrongly placed horizontally (i. e., wrong 'column' for discrete values). This only seems to be an issue ifwidth = 0
.If
position_dodge2()
is not intended to be used withgeom_point()
a warning would be helpful.Created on 2021-01-26 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: