It may be simpler to calculate your own polar coordinates, and plot on a cartesian grid.
Some dummy data (where all angles are less than 360, but with data points crossing the 360/0 boundary, as described in the comment)
df = data.frame(angle.from.ref = rep(seq(0,350,10), 4))
df$time.step = seq_along(df$angle.from.ref)
Now we use basic trig to calculate the position on a cartesian plane:
df$x = sin(pi * df$angle.from.ref/180) * df$time.step
df$y = cos(pi * df$angle.from.ref/180) * df$time.step
and plot using geom_path
ggplot(df, aes(x, y)) +
geom_path() +
geom_point() +
coord_equal()

To replace the cartesian grid with a polar one, we can also calculate the coordinates for the gridlines (I put into a function for convenience)
ggpolar = function(theta, r) {
# convert polar coordinates to cartesian
x = sin(pi * theta/180) * r
y = cos(pi * theta/180) * r
# generate polar gridlines in cartesian (x,y) coordinates
max.r = ceiling(max(r) / 10) * 10
grid.a = data.frame(a = rep(seq(0, 2*pi, length.out = 9)[-1], each=2))
grid.a$x = c(0, max.r) * sin(grid.a$a)
grid.a$y = c(0, max.r) * cos(grid.a$a)
circle = seq(0, 2*pi, length.out = 361)
grid.r = data.frame(r = rep(seq(0, max.r, length.out = 4)[-1], each=361))
grid.r$x = sin(circle) * grid.r$r
grid.r$y = cos(circle) * grid.r$r
labels = data.frame(
theta = seq(0, 2*pi, length.out = 9)[-1],
lab = c(seq(0,360,length.out = 9)[-c(1,9)], "0/360"))
labels$x = sin(labels$theta) *max.r*1.1
labels$y = cos(labels$theta) *max.r*1.1
#plot
ggplot(data.frame(x,y), aes(x, y)) +
geom_line(aes(group=factor(a)), data = grid.a, color='grey') +
geom_path(aes(group=factor(r)), data = grid.r, color='grey') +
geom_path() +
geom_point() +
coord_equal() +
geom_text(aes(x,y,label=lab), data=labels) +
theme_void()
}
ggpolar(df$angle.from.ref, df$time.step)

Also, demonstrating the same with data similar to your example that oscillates across the 360/0 line:
set.seed(1234)
df = data.frame(angle = (360 + cumsum(sample(-25:25,20,T))) %% 360)
df$time.step = seq_along(df$angle)
ggpolar(df$angle, df$time.step)

Edit: A slightly more complex version that draws curved lines
One issue with the above solution is that the line segments are straight, rather than curved along the angles. Here's a slightly improved version that draws either spline or polar curves between the points using method='spline'
or method='approx'
, respectively.
plus360 = function(a) {
# adds 360 degrees every time angle crosses 360 degrees in positive direction.
# and subtracts 360 for crossings in negative direction
a = a %% 360
n = length(a)
up = a[-n] > 270 & a[-1] < 90
down = a[-1] > 270 & a[-n] < 90
a[-1] = a[-1] + 360* (cumsum(up) - cumsum(down))
a
}
ggpolar = function(theta, r, method='linear') {
# convert polar coordinates to cartesian
x = sin(pi * theta/180) * r
y = cos(pi * theta/180) * r
p = data.frame(x,y)
if (method=='spline') {
sp = as.data.frame(spline(r,plus360(theta),10*length(r)))
} else {
if (method=='approx') {
sp = as.data.frame(approx(r,plus360(theta),n=10*length(r)))
} else {
sp = data.frame(x=r, y=theta)
}
}
l = data.frame(
x = sin(pi * sp$y/180) * sp$x,
y = cos(pi * sp$y/180) * sp$x)
# generate polar gridlines in cartesian (x,y) coordinates
max.r = ceiling(max(r) / 10) * 10
grid.a = data.frame(a = rep(seq(0, 2*pi, length.out = 9)[-1], each=2))
grid.a$x = c(0, max.r) * sin(grid.a$a)
grid.a$y = c(0, max.r) * cos(grid.a$a)
circle = seq(0, 2*pi, length.out = 361)
grid.r = data.frame(r = rep(seq(0, max.r, length.out = 4)[-1], each=361))
grid.r$x = sin(circle) * grid.r$r
grid.r$y = cos(circle) * grid.r$r
labels = data.frame(
theta = seq(0, 2*pi, length.out = 9)[-1],
lab = c(seq(0,360,length.out = 9)[-c(1,9)], "0/360"))
labels$x = sin(labels$theta) *max.r*1.1
labels$y = cos(labels$theta) *max.r*1.1
#plot
ggplot(mapping = aes(x, y)) +
geom_line(aes(group=factor(a)), data = grid.a, color='grey') +
geom_path(aes(group=factor(r)), data = grid.r, color='grey') +
geom_path(data = l) +
geom_point(data = p) +
coord_equal() +
geom_text(aes(x,y,label=lab), data=labels) +
theme_void()
}
using splines it looks like this
ggpolar(df$angle, df$time.step, method = 'spline')

and with polar curves which interpolate the angle
ggpolar(df$angle, df$time.step, method = 'approx')
