Skip to content

Instantly share code, notes, and snippets.

@SantoshSrinivas79
Forked from gkaramanis/what-people.R
Created February 21, 2020 05:14
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 SantoshSrinivas79/a2d6559dc1e34a958c9f586b79fc75b1 to your computer and use it in GitHub Desktop.
Save SantoshSrinivas79/a2d6559dc1e34a958c9f586b79fc75b1 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