Lines not straight in ggplot polar plot in R

Viewed 25

Hopefully you can help me out. I'm working on polar plots to show my data, but the arrows I'm plotting keep on being blurry/not smooth/straight. Any ideas on how to solve this?

Many thanks!

enter image description here

""

limit = 160
# polar plot
polar <- ggplot(data_polar, aes(x=angle, y=PEV))+
  coord_polar(start = 1.5*pi, direction=-1, clip="off")+
  geom_segment(aes(y=0, xend=angle, yend=PEV, color=electrode), 
               arrow=arrow(length = unit(0.02, "npc")), 
               size=1.1)+
  scale_x_continuous(limits=c(0, 360), breaks=c(0, 90, 180, 270), labels=c("         0\u00B0","90\u00B0\n\n", "180\u00B0            ", "\n\n270\u00B0"))+
  scale_y_continuous(limits=c(0, limit), breaks=c(limit/4, limit/2, limit*0.75, limit))+
  scale_color_manual(values = c("LAN" = "red", 
                                "SAN"="green", 
                                "PAN"="blue", 
                                "LANPAN"="purple", 
                                "LANSAN"="brown"
                                )) +
  theme_bw()+
  theme(panel.border = element_blank(),
        legend.position="bottom",
        panel.grid.minor = element_line(size = 0.5), panel.grid.major = element_line(size = 1),
        axis.text.x = element_text( size=11, face="bold"), axis.title.x=element_blank(), axis.text.y =element_blank(), axis.ticks.y =element_blank(), axis.title.y =element_blank())+
  labs(color = "Electrode(s)", title="Subject 2")+
  geom_text(x = 360-67.5, y = limit, label = limit, size = 3.5, color="black")+
  geom_text(x = 360-67.5, y = limit*0.25, label = limit*0.25, size = 3.5, color="black") +
  geom_text(x = 360-67.5, y = limit*0.5, label = limit*0.5, size = 3.5, color="black") +
  geom_text(x = 360-67.5, y = limit*0.75, label = limit*0.75, size = 3.5, color="black") +
  geom_text(x = 360-67.5, y = limit*1.3, label = "PEV\n(dps)", size = 2.5, color="grey") 

""

0 Answers
Related