Closed
Description
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.
library(ggplot2)
data <- data.frame(x = rep(seq(2018, 2021, 1), 15),
y = sample(seq(3, 5, .125), 60,
replace = T))
ggplot(data, aes(factor(x), y)) +
geom_dotplot(binaxis = "y", stackdir = "center", stackratio = 1)
#> Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.
ggplot(data, aes(factor(x), y)) +
geom_dotplot(binaxis = "y", stackdir = "center", stackratio = 2) #points shifted to left
#> Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.
ggplot(data, aes(factor(x), y)) +
geom_dotplot(binaxis = "y", stackdir = "center", stackratio = 0.5) #points shifted to right
#> Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.
Created on 2021-09-14 by the reprex package (v2.0.1)