rggplot2rose-plot

Rose diagram for migration data


I am trying to create a rose diagram showing average trajectory angle and distance for each subset of cells. I want the angle around the rose diagram to be the trajectory angle and the length of the bar in the diagram to be the total displacement.

Here is a test data set of the mean angle and displacement per group.

testsum<-data.frame(Group=c(1,2,3),
                angle=c(0.78,1.04,2.094),
                displacement=c(1.5,2,1))

When I try to plot this in a circular method, my chart looks very wrong.

p1<-ggplot(testsum, aes(x=angle,y=displacement))+
  coord_polar(theta="x",start=0)+
  geom_bar(stat="identity",aes(color=Group,fill=Group),width=.01)+    
  scale_x_continuous(breaks=seq(0,360,60))

It gives me this graph for output.

enter image description here

When based on what the data says, it should look more like this (drawing of intended output). enter image description here

It seems to be placing the angles incorrectly? Any idea what I am doing wrong?


Solution

  • Maybe you can try this:

    testsum$angle_b=180*testsum$angle/pi
    #
    ggplot(testsum, aes(x=angle_b,y=displacement))+
        geom_bar(stat="identity",aes(color=Group,fill=Group),width=1) +    
        scale_x_continuous(breaks=seq(0,360,10), limits=c(0,360)) + coord_polar(direction=1)