A shot at the why:
This is based on your example 3:
There is an interaction between geom_path
and coord_polar
going on. At the end of the first circuit (0 to 2pi) here is x:
x[360:362,]
# A tibble: 3 x 3
x sine rads
<dbl> <dbl> <dbl>
1 6.265732 1.017364 6.26573201
2 6.283185 1.034907 0.00000000
3 6.300639 1.052449 0.01745329
geom_path
connects the points in the order they appear. You see it goes from 6.26 (2pi - epsilon) to 0, so geom_path
draws a segment from (6.26, 1.017) to (0,1.03). Segments in polar coordinates are arcs around the circle (not really a circle here because the radius is changing) and the segment goes backward in radians. Hence the 'circle' going backward to the next point which starts the next circuit.
The gaps appear when you did your grouping for the same reason - just those backward circles are not drawn anymore.
Based on its documentation ggplot2::coord_polar
appears to have been designed mainly for pie charts and not actually plotting functions in the standard polar coordinate system. This would explain some of the behavior (e.g. expanding the x's from 0, 6*pi in your first example). Perhaps that's a new topic...