Skip to content

Instantly share code, notes, and snippets.

@jayjacobs
Last active May 4, 2016 04:32
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 jayjacobs/3e95c4fb07e24be6f6bf8f94a308bc9d to your computer and use it in GitHub Desktop.
Save jayjacobs/3e95c4fb07e24be6f6bf8f94a308bc9d to your computer and use it in GitHub Desktop.
library(ggplot2)
x <- seq(2,6,0.05)
toplot <- data.frame(x=x, y=dnorm(x, mean=4, sd=0.5))
gg <- ggplot(toplot, aes(x,y)) +
geom_polygon(fill="lightsteelblue", color="steelblue") +
geom_segment(data=data.frame(x=4, xend=4, y=0, yend=0.82),
aes(x, xend=xend, y=y, yend=yend),
color="steelblue4", size=1) +
geom_text(data=data.frame(x=1.7, y=0.1,txt="2+2="), aes(x,y,label=txt),
size=62, vjust=0, color="steelblue4") +
scale_x_continuous(limit=c(-0, 5.5), breaks=c(3,4,5), expand=c(0,0)) +
scale_y_continuous(limit=c(0,0.82), expand=c(0,0)) +
theme(panel.background=element_rect(fill=NA, color=NA),
panel.grid.major=element_blank(),
axis.text.y=element_blank(),
axis.text.x=element_text(size=22),
axis.title=element_blank(),
axis.ticks.y=element_blank())
print(gg)
# ggsave(gg, filename = "2plus2.pdf", width=10.5, height=2.6)
# system("open 2plus2.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment