How to plot points around a circle in R

2019-08-02 07:43发布

问题:

I am trying to plot some data on directions which vary from 0 to360 deg. The most intuitive way of doing this is around a circle where I can plot each point (I only have 13 points to plot).

cont=c(319,124,182,137,55,302,221,25,8,36,132,179,152)

My data for one plot

I tried following the ggplot2 guides and have not got it to work. I'm not very good at ggplot though...

(my dataframe is called "data")

ggplot(data, aes(x=1), ) + coord_polar(theta = "y") +geom_point(y=cont)

回答1:

It works adding y to the ggplot mapping

data <- data.frame(cont = cont)
ggplot(data, aes(x=1, y = cont)) + coord_polar(theta = "y") + geom_point()

You can add other ggplot parameters to improve the appearence.



回答2:

Have you tried polar.plot from plotrix library?



标签: r plot geometry