'Adjust binwidth size for faceted dotplot with free y axis
I would like to adjust the binwidth of a faceted geom_dotplot while keeping the dot sizes the same.
Using the default binwidth (1/30 of the data range), I get the following plot:
library(ggplot2)
df = data.frame(
t = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
x = 1,
y = c(1, 2, 3, 4, 5, 100, 200, 300, 400, 500)
)
ggplot(df, aes(x=x, y=y)) +
geom_dotplot(binaxis="y", stackdir="center") +
facet_wrap(~t, scales="free_y")
However, if I change the binwidth value, the new value is taken as an absolute value (and not the ratio of the data range), so the two facets get differently sized dots:
geom_dotplot(binaxis="y", stackdir="center", binwidth=2) +
Is there a way to adjust binwidth so it is relative to its facet's data range?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


