Overlapping Points in Polar Coordinates

Viewed 273

I am trying to create a polar chart in R. However, my first and last point end up being plotted at the same point. I would prefer not to create another row in my dataframe such that it would still have the overlap, but the new row would be a dummy row. I would like there to simply be k points of equi distance from each other. So 1 is plotted at r=5 and theta=pi/2. The next point 2 at r=5 and theta=9pi/10, etc Observe,

k<-5   
x_vector<-seq(1,k,1)
radius<-rep(5,k,1)
name<-c('A','B','C','D','E')
df<-data.frame(x_vector,radius,name)
p<-ggplot()+
 geom_point(data=df,aes(x=x_vector,y=radius,color=name,fill=name),size=3,shape=21)+
coord_polar(theta='x',start=0,direction=-1,clip='on')+
scale_y_continuous(limits=c(0,5))
p

Creates this: enter image description here

As you can see, I would like the 1 and 5 points to be seperate. Also I do not want to plot them in cartesian and then convert. I feel like this is an issue others have encountered, but cannot find something on it.

0 Answers
Related