Skip to content

Instantly share code, notes, and snippets.

@orrymr
Created September 13, 2021 18:11
Show Gist options
  • Save orrymr/bab5d7d2bd7f8990c2ce96e9ae263d2a to your computer and use it in GitHub Desktop.
Save orrymr/bab5d7d2bd7f8990c2ce96e9ae263d2a to your computer and use it in GitHub Desktop.
n_ <- 2000
m_ <- 10000
g <- ggplot(roll(m = m_, n = n_),
mapping = aes(x = V1)) +
geom_vline(xintercept = 3.5, colour = "tomato3") +
labs(
subtitle = str_interp('Density of means of dice
rolls for ${n_} dice over ${m_} rolls.'),
x = 'Mean Score',
y = 'Proportion of the time the value was observed'
) +
geom_bar(aes(y = ..prop..), alpha = 0.4) +
scale_x_continuous(
breaks = 1:6,
lim = c(0, 7)
) +
geom_density()
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment