help with circular data plotting

So I'm fairly new to using Rstudio. I've been creating a circular histogram looking at the orientation of insects, using the circular package.

using the commands:

FOnomag <- c(15,15,15,30,45,45,45,45,60,75,75,90,90,105,105,105,105,105,120,135,135,135,135,150,150,150,150,165,165,165,180,180,180,180,195,195,195,195,195,195,195,195,210,210,210,210,210,225,240,240,255,255,255,270,270,285,300,300,315,330)

FOn.cir <- circular(FOnomag, units = "degrees")

FOn.mean <- mean(FOn.cir, na.rm = TRUE)

plot.circular(FOn.cir, stack = TRUE, pch = 20, sep = 0.08, shrink =1.6)

arrows.circular(FOn.mean)

I have been able to plot the orientation of each of my insects and add an arrow for the mean orientation. my issue is Id like to add a section to my plot to show the mean standard error and I have no idea how this can be done.

Any advice would be greatly appreciated!

library(ggplot2)
library(tibble)

as_tibble(c(15,15,15,30,45,45,45,45,60,75,75,90,90,105,105,105,105,105,120,135,135,135,135,150,150,150,150,165,165,165,180,180,180,180,195,195,195,195,195,195,195,195,210,210,210,210,210,225,240,240,255,255,255,270,270,285,300,300,315,330)) -> FOnomag

f_mu <- mean(FOnomag$value)
std <- function(x) sd(x)/sqrt(length(x))
mse <- std(FOnomag$value)
headline <- paste("The ants go marching to",f_mu,"with an MSE of",mse)
p <- ggplot(FOnomag,aes(value), color = as.factor(value))
p + geom_bar() + coord_polar() + 
    geom_vline(aes(value), xintercept = f_mu) +
    labs(title = headline) +
    theme_minimal()
#> Warning: geom_vline(): Ignoring `mapping` because `xintercept` was provided.

Created on 2020-07-22 by the reprex package (v0.3.0)
Many other annotation options available in ggplot2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.