Skip to content

Instantly share code, notes, and snippets.

@statwonk
Created June 19, 2019 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statwonk/a329f696f2211965e9f0a5cebd2e8970 to your computer and use it in GitHub Desktop.
Save statwonk/a329f696f2211965e9f0a5cebd2e8970 to your computer and use it in GitHub Desktop.
Part of the Normal family of distributions.
library(tidyverse)
plot.new()
par(bg = "black")
plot(density(rnorm(1e6)), col = "deeppink", lwd = 1,
xlab = "", ylab = "", main = "Normal distribution", axes = FALSE)
seq(1, 10, 0.05) %>%
map(function(x){ rnorm(1e5, 0, x)}) %>%
map(function(x) { density(x) %>%
lines(col = colors() %>% Filter(function(.x) grepl("pink", .x), .) %>% sample(1),
lwd = sample(seq(0.1, 0.1, 0.01), 1),
lty = 1)}) %>%
invisible()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment