How can I change the position of the axis text in a ggplot polar plot?

I'd like to change the position of the x.axis.text on my polar plot to align with its corresponding circle on the plot. How do I do that?

Here is a sample code.

set.seed(1)
y = sample.int(360,20)
set.seed(20)
x = sample.int(360, 20)
time = seq.int(0, 20, length.out = 20)
data.set = data.frame('time' = time, 'x'= x, 'y' = y)
fig = ggplot(data.set) + theme_minimal() + xlab('') + ylab('')
fig + geom_point(aes(time, x), size = 1, stroke = 0, color = 'green', alpha = .5) + geom_point(aes(time, y), size = 1, stroke = 0, color = 'blue', alpha = .5) + coord_polar(start = 90 * pi/180, theta = 'y') +  scale_y_continuous(lim = c(0, 359), breaks = seq(0, 360, 90))

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.