I would like to add the y-axis labels automatically inside a coord_polar
plot with geom_point
. Here is a reproducible example:
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = mpg, color = factor(am))) +
geom_point() +
coord_polar() +
labs(color = 'am')
Created on 2022-10-31 with reprex v2.0.2
Here you can see the y-axis labels are on the side, but I want them to be inside the polar graph. I know you could use annotate
like this:
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = mpg, color = factor(am))) +
geom_point() +
coord_polar() +
labs(color = 'am') +
annotate('text', x = 0, y = c(15, 20, 25, 30), label = c('15', '20', '25', '30'))
Created on 2022-10-31 with reprex v2.0.2
But this isn't very automatic. So I was wondering if there is an automatic way of adding y-axis labels inside a coord_polar
graph like the above?