Description
"width(height)" argument in geom_jitter() is described as belows.
width
Amount of vertical and horizontal jitter. The jitter is added in both positive and negative directions, so the total spread is
twice the value specified here
. If omitted,defaults to 40% of the resolution of the data
: this means thejitter values will occupy 80%
of the implied bins.
So, I expected geom_jitter()
and geom_jitter(width = 0.4)
will produce same plot and "width = 0.4"
spreads points across a range "base ± resolution * 0.4"
. but the results are not.
> p <- ggplot(mtcars, aes(gear, mpg))
> p + geom_jitter() ## jitter range is 3 ± 0.4
> p + geom_jitter(width = 0.4) ## jitter range is narrow than 3 ± 0.4
I'm confusing about width argument and how can i calculate a jitter range.
I expect like belows but the result doesn't
geom_jitter(width = 0.2
) will spread points across a range [2.8 ~ 3.2] : 3 ± 0.2
geom_jitter(width = 0.4
) will spread points across a range [2.6 ~ 3.4] : 3 ± 0.4
geom_jitter(width = 0.6
) will spread points across a range [2.4 ~ 3.6] : 3 ± 0.6
but, geom_point(aes(x = jitter(gear, amount = 0.2))
produce a plot what i expected.
Please, give me some hints...