ggplot geometry question

I want to insert the arc denoting the angle and label it with the Greek letter theta. The angle is about 27 degrees, 0.4707048 radians. Any ideas?


tibble(p=seq(from=0,to=1,by=.00001)) %>% 
  mutate(top_half       =  1/2 + sqrt(p*(1-p)),
         bottom_half    =  1/2 - sqrt(p*(1-p))) -> mydata

g <- ggplot(mydata,aes(x=p))         +
  geom_line(aes(y=top_half))          +
  geom_line(aes(y=bottom_half))       +
  theme_classic()                     +
  coord_fixed(1)                      +
  geom_hline(yintercept = c(1/2,1/2)) +
  geom_segment(aes(x=.75,y=.5,xend = .65, yend = 1/2+sqrt(.65*.35)),
               arrow = arrow(length = unit(0.5, "cm"))) +
  geom_segment(aes(x=.75,y=.5,xend = .85, yend = 1/2+sqrt(.85*.15)),
               arrow = arrow(length = unit(0.5, "cm")))  +
  ylab(TeX('$\\sqrt[2]_{p(1-p)}\\pm\\frac{1}{2}$')) 

g

Sorry, here is the code.

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