I am trying to use a polar plot to represent frequencies according to a circular angle/direction (0-360 degrees). For some reason I am having problems trying to define the scale in the plot to represent all 3 angles. At the moment only 2 are showing ("B" and "C"). Any help will be appreciated. Thanks in advance,
library(ggplot2)
data <- read.table(text = "stat angle freq perc
A 1 720 79
B 223.5017 121 13
C 117.9372 68 7", header=T)
head(data)
str(data)
db<-data
db$stat<-factor(db$stat)
levels(db$stat)
# Plot
bp<-ggplot(db, aes(x = angle, y = perc), fill = factor(stat)) +
geom_bar(stat="identity", colour="grey100", aes(fill = factor(stat),
width = 16)) +
coord_polar(theta="x", start=0) +
theme_minimal() + ylab("Detections (%)") +
scale_x_continuous("", lim=c(0,360), breaks = seq(0, 315, 45),
labels = c("N","NE","E","SE","S","SW","W","NW"))
bp2<-bp + theme(panel.grid.major = element_line(colour = "grey60", size=0.45),
panel.grid.minor = element_line(colour = "grey60", size=0.45))