Jittered points clipped with coord_polar



I'm doing a visualisation of a series of points using coord_polar(). Because these points have an angle whose precision is maybe 5 or 10 degrees, I'm jittering them—but I'm finding that points with an angle right on the limits (ie. 0 or 360) get cut off unless their jittered values land inside the (0, 360) range. In other words, points at θ = 360 with positive jitter width, or values at θ = 0 with negative jitter width, are lost.

I have a reprex here, although I'm finding that the results aren't fully reproducible because geom_jitter doesn't appear to respect set.seed():

#> Warning: package 'ggplot2' was built under R version 3.5.1
#> Warning: package 'dplyr' was built under R version 3.5.1

test = crossing(
  angle = seq(0, 360, 15),
  radius = 1:5)

ggplot(test, aes(x = angle, y = radius)) +
  geom_jitter(aes(colour = angle), width = 2, height = 0) +
  scale_x_continuous(limits = c(0, 360), breaks = seq(0, 360, by = 45)) +
#> Warning: Removed 5 rows containing missing values (geom_point).

Created on 2018-10-09 by the reprex package (v0.2.0).

You can see from this particular jitter that some of the points at either 0 or 360 have been rendered, but at other radii both have been clipped. I'd hoped that specifying clip = 'off' might fix this, but no dice.

It seems like this is probably an understood present limitation of geom_jitter:

Would the best bet here be to generate the randomness myself and then manually wrap the angles?


FYI, if anyone's looking for help on this: I am manually jittering and wrapping my points.

jitter_width = 4
test = test %>%
  mutate(angle_jittered = 
    (angle + runif(angle, min = -jitter_width, max = jitter_width)) %% 360)