-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Dots misaligned in geom_dotplot #4614
Comments
The code in question is almost 10-years old. I attempted to dive into the history, but couldn't figure out what's the right thing here... Line 36 in 759c63c
|
I never use |
Hmmm.... FWIW, without extensive testing but just from reading the code and comparing it to the approach in ggdist, if I'm correctly understanding the meaning of |
I was fixing a somewhat related bug in {ggdist} the other day when the solution to this bug hit me. The problem that the # using a modified geom_dotplot without the (1 - x$stackratio) / 2 adjustment
ggplot(data.frame(x = c(rep(1, 3), rep(2, 2))), aes(x)) +
geom_dotplot(binwidth = 0.5, alpha = 0.5, stackdir = "up", stackratio = 1.5) +
coord_fixed() +
ylim(-2, 2) +
xlim(0, 6) The unmodified # using the main branch of ggplot2 on github
ggplot(data.frame(x = c(rep(1, 3), rep(2, 2))), aes(x)) +
geom_dotplot(binwidth = 0.5, alpha = 0.5, stackdir = "up", stackratio = 1.5) +
coord_fixed() +
ylim(-2, 2) +
xlim(0, 6) For example, here is # using the main branch of ggplot2 on github
ggplot(data.frame(x = c(rep(1, 3), rep(2, 2))), aes(x)) +
geom_dotplot(binwidth = 0.5, alpha = 0.5, stackdir = "down", stackratio = 1.5) +
coord_fixed() +
ylim(-2, 2) +
xlim(0, 6) The solution is that the Line 36 in c89c265
Line 41 in c89c265
Needs to depend on
I have a PR incoming shortly with this fix (and tests). |
Hello!
I've ran into a problem where the dots of geom_dotplot are not aligned correctly. The problem was described here years ago, but it seems to still be here (and I couldn't find any issue about it so I assume nobody ever filed one). The link also provides a possible solution but no one seems to have a clue if this solution affects anything elsewhere.
Created on 2021-09-14 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: