Skip to content

Instantly share code, notes, and snippets.

@dggoldst
Created July 29, 2019 04:09
Show Gist options
  • Save dggoldst/21891afb4ca02f56c86a6bcc291da43c to your computer and use it in GitHub Desktop.
Save dggoldst/21891afb4ca02f56c86a6bcc291da43c to your computer and use it in GitHub Desktop.
library(tidyverse)
df=data.frame(x=seq(-3.5,3.5,.01))
df = df %>% mutate(y=dnorm(x,sd=1))
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")
p = p + scale_x_continuous(breaks=seq(-3,3,1))
p = p + geom_line()
p
ggsave(plot=p,file="norm.png",height=4,width=8)
df=data.frame(x=seq(-3.5*25,3.5*25,.01*25))
df = df %>% mutate(y=dnorm(x,sd=25))
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(),
panel.grid.minor.y = element_blank()
) +
labs(x="Measurement")
p = p + scale_x_continuous(breaks=seq(-100,100,20))
p = p + scale_y_continuous(breaks=seq(0,max(df[,2]),max(df[,2])/8))
p = p + geom_line()
p
ggsave(plot=p,file="norme.png",height=4,width=8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment