Skip to content

Instantly share code, notes, and snippets.

@aammd
Created March 15, 2020 18:29
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 aammd/050f0151812d86c049af91b7eda20a7e to your computer and use it in GitHub Desktop.
Save aammd/050f0151812d86c049af91b7eda20a7e to your computer and use it in GitHub Desktop.
library(tidyverse)
cv <- 2.5
sigma = seq(0.2,5,by = 0.2)
list(mean = sigma / cv, sd = sigma) %>% transpose %>%
  set_names(., nm = map_chr(., lift_dl(paste, sep="_"))) %>%
  map(lift_dl(partial, .f = dnorm)) %>%
  map_df(~ tibble(x = seq(-2,3.5,0.01),
               y = .x(x)), .id = "mean_sd") %>%
  ggplot(aes(x = x, ymax = y, ymin = 0, fill = mean_sd)) + geom_ribbon() +
  scale_fill_viridis_d(option= "magma", direction = -1) +
  theme_dark() +
  guides(fill = FALSE)

Created on 2020-03-15 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment