Skip to content

Instantly share code, notes, and snippets.

@dggoldst
Last active July 29, 2019 04:27
Show Gist options
  • Save dggoldst/5dfdbf5b431509b35331ca287dd0a7f5 to your computer and use it in GitHub Desktop.
Save dggoldst/5dfdbf5b431509b35331ca287dd0a7f5 to your computer and use it in GitHub Desktop.
library(tidyverse)
#Standard normal
df = data.frame(x = seq(-3.5, 3.5, .01)) %>%
mutate(y = dnorm(x))
p = ggplot(df, aes(x, y))
p = p + theme_bw() +
theme(
axis.title.y = element_blank(),
axis.text.y = element_blank(),
panel.grid.minor.x = element_blank()
) +
labs(x = "Standard Deviations") +
scale_x_continuous(breaks = seq(-3, 3, 1)) +
geom_line()
p
#For guessing (Mar 6, 2019 post)
scl = 25 #scaling factor
df = data.frame(x = seq(-3.5 * scl, 3.5 * scl, .01 * scl)) %>%
mutate(y = dnorm(x, sd = 25))
peak=max(df$y)
p = ggplot(df, aes(x, y))
p = p + theme_bw() +
theme(
axis.title.y = element_blank(),
axis.text.y = element_blank(),
panel.grid.minor.y = element_blank()
) +
labs(x = "Measurement") +
scale_x_continuous(breaks = seq(-4*scl, 4*scl, 4*scl/5)) +
scale_y_continuous(breaks = seq(0, peak, peak/8)) +
geom_line()
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment