I am plotting orientations ranging between 0 - 180 degrees of lineations in ggplot2 to make rose diagrams of orientation using:
ggplotrose <- function(data, title){
dat <-data.frame(data)
colnames(dat)[1] <- 'dat_x'
ggplot(dat, aes(x=dat_x)) +
stat_bin(binwidth = 10, drop = FALSE, right = TRUE, col = "black", fill= "green") +
coord_polar() + ylab("Count") + ggtitle(title) +
scale_x_continuous("", limits = c(0, 360), breaks = seq(0, 360, 10))
}
I want to add in lines unrelated to my dataset showing the dominant orientations of regional faults (35 and 160 degrees) - i.e. add a red line trending to 35 degrees and one trending to 160 degrees on top of my existing rose diagram.
angles <- sample(0:180, 250, replace=TRUE) #lineations with orientation between 0-180
fault <- 35 #fault orientation is 35 degrees
p <- ggplotrose(angles, 'sample data') #create rose diagram of orientations
p + geom_segment(data=fault, aes(x=0, xend=cos(fault*(pi/180)), y=0,
yend=sin(fault*(pi/180))), colour="red") #my attempt using geom_segment() which didn't work
I have tried using geom_line(), geom_segment(), geom_abline() but haven't been able to make any of them work.
Any suggestions would be much appreciated, thanks!