Skip to content

Instantly share code, notes, and snippets.

@juanchiem
Forked from gkaramanis/what-people.R
Created February 20, 2020 20:08
Show Gist options
  • Save juanchiem/08731365e80deed88cfb07d922b5465d to your computer and use it in GitHub Desktop.
Save juanchiem/08731365e80deed88cfb07d922b5465d to your computer and use it in GitHub Desktop.
library(ggplot2)
ggplot(data = data.frame(x = c(-4, 6)), aes(x)) +
stat_function(fun = dnorm, n = 101, args = list(mean = 0, sd = 1), geom = "area", fill = "#F5BB87", alpha = 0.9) +
stat_function(fun = dnorm, n = 101, args = list(mean = 2.7, sd = 1), geom = "area", fill = "#BBD4EB", alpha = 0.9) +
coord_fixed(xlim = c(-5, 7), ratio = 8, clip = "off") +
annotate("segment", x = -3.9, y = 0, xend = 6, yend = 0, color = "grey60", size = 1.3) +
annotate("segment", x = -3.5, y = -0.04, xend = -3.5, yend = 0.42, color = "grey60", size = 1.3) +
annotate("text", x = 0, y = 0.18, label = "what people\nactually do\nin R", family = "Arial Bold", color = "white", size = 5.2) +
annotate("text", x = 2.75, y = 0.18, label = "what people\nassume others\ndo in R", family = "Arial Bold", color = "white", size = 5.2) +
annotate("text", x = -1.25, y = -0.03, label = "← less complicated", family = "Arial Bold", color = "grey60", size = 5.2) +
annotate("text", x = 3.25, y = -0.03, label = "more complicated →", family = "Arial Bold", color = "grey60", size = 5.2) +
theme_void() +
ggsave("~/Desktop/normal.png", width = 10, height = 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment