library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.0.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'tibble' was built under R version 3.6.2
## Warning: package 'purrr' was built under R version 3.6.2
## Warning: package 'dplyr' was built under R version 3.6.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
Pi = .3
Complement = 1-Pi
PiTimesComplement = Pi*(Complement)
SqrtPiTimesComplement = sqrt(PiTimesComplement)
OneOverSqrtNs = 1/sqrt(1:10000)

library(ggstamp)
ggcanvas() +
    stamp_segment(yend = 0) +
    stamp_point(size = 2, x = 1) +
    stamp_point(size = 2) +
    stamp_spoke(x0 = Pi, y0 = 0,
                angle = pi,
                radius = Pi,
                color = "cadetblue"
                ) +
    stamp_spoke(x0 = Pi, y0 = 0, angle = 0,
                radius = 1 - Pi,
                color = "goldenrod3") +
    stamp_point(x = Pi, y = 0, size = 3)

ggcanvas() +
    stamp_segment(yend = 0) +
    stamp_point(size = 2, x = 1) +
    stamp_point(size = 2) +
    stamp_spoke(x0 = Pi, y0 = 0,
                angle = seq(from = pi, to = .5*pi, by = -pi/20),
                radius = Pi,
                alpha = 1:11*1/11,
                color = "cadetblue"
    ) +
    stamp_spoke(x0 = Pi, y0 = 0, angle = 0,
                radius = 1 - Pi,
                color = "goldenrod3") +
    stamp_point(x = Pi, y = 0, size = 3)

ggcanvas() +
    stamp_segment(yend = 0) +
    stamp_point(size = 2, x = 1) +
    stamp_point(size = 2) +
    stamp_spoke(x0 = Pi, y0 = 0,
                angle = seq(from = pi, to = .5*pi, by = -pi/20),
                radius = Pi,
                alpha = 1:11*1/11,
                color = "cadetblue"
    ) +
    stamp_spoke(x0 = Pi, y0 = 0, angle = 0,
                radius = 1 - Pi,
                color = "goldenrod3") +
    stamp_point(x = Pi, y = 0, size = 3) +
    stamp_rect(xmin = Pi, ymin = 0,
               xmax = 1, ymax = Pi,
               color = "cadetblue",
               fill = "cadetblue",
               alpha = .3)
## Warning: Ignoring unknown aesthetics: x, y

ggcanvas() +
    stamp_segment(yend = 0) +
    stamp_point(size = 2, x = 1) +
    stamp_point(size = 2) +
    stamp_spoke(x0 = Pi, y0 = 0,
                angle = seq(from = pi, to = .5*pi, by = -pi/20),
                radius = Pi,
                alpha = 1:11*1/11,
                color = "cadetblue"
    ) +
    stamp_spoke(x0 = Pi, y0 = 0, angle = 0,
                radius = 1 - Pi,
                color = "goldenrod3") +
    stamp_point(x = Pi, y = 0, size = 3) +
    stamp_rect(xmin = Pi, ymin = 0,
               xmax = 1, ymax = Pi,
               color = "cadetblue",
               fill = "cadetblue",
               alpha = .05)  +
    stamp_rect(xmin = Pi + sqrt(Pi * (1-Pi)), ymin = 0,
               xmax = Pi, ymax = sqrt(Pi * (1-Pi)),
               color = "cadetblue",
               fill = "cadetblue",
               alpha = .3)
## Warning: Ignoring unknown aesthetics: x, y
## Ignoring unknown aesthetics: x, y

last_plot() + 
    stamp_segment(x = Pi + sqrt(Pi * (1-Pi)), 
                  y = 0, xend = Pi,
                  yend = 0, size = 5,
                  color = "cadetblue")

last_plot() +
    ggxmean::stamp_normal_dist(mean = Pi, sd = SqrtPiTimesComplement)

last_plot() +
    scale_x_continuous(limits = c(-.25, 1.25))

last_plot() + 
    stamp_point(x = Pi + OneOverSqrtNs*SqrtPiTimesComplement,
                size = 1)

last_plot() + 
    ggxmean::stamp_normal_dist(mean = Pi, 
                               sd = SqrtPiTimesComplement * 
                                   1/sqrt(30),
                               height = 4) + 
    ggxmean::stamp_normal_dist(mean = Pi, 
                               sd = SqrtPiTimesComplement * 
                                   1/sqrt(20),
                               height = 2)