Skip to content

Instantly share code, notes, and snippets.

@Shellfishgene
Created July 23, 2020 07:52
Show Gist options
  • Save Shellfishgene/95988ad58f0ebcbaa595d57b46430d95 to your computer and use it in GitHub Desktop.
Save Shellfishgene/95988ad58f0ebcbaa595d57b46430d95 to your computer and use it in GitHub Desktop.
Hamlet comics
library(hypoimg)
library(cowplot)
l_t <- c("Hola", "Peaks!", "I think we're not so different after all!", "No no! I don't mean that. We look different,\nbut we're not so different genetically!", "So, you see me differently now?\nAfter all, maybe we could try again...")
r_t <- c("Hola!", "Whatcha looking at?","Ok...what do they mean?", "This again! It was a single spawning,\nand I was drunk on snapping shrimp cocktail,\nand...", "Oh, yeah. Looking at it closely, we look\ndifferently and we see differently, too!", "NO!\nWe have to keep speciation going!")
dat <- tibble( x = c(runif(125, min = 0, max = 3.75), runif(50, max = 0.5) + 3.75, runif(125, min = 4.25, max = 8)), y = c(rnorm(n = 125, mean = 0.02, sd = 0.2), rnorm(n=50, mean = 0.75, sd = 1), rnorm(n = 125, mean = 0.02, sd = 0.2)))
base <- ggplot(dat, aes(x = x, y = y))+
scale_x_continuous(limits = c(0, 8))+
scale_y_continuous(limits = c(-0.2, 5)) +
geom_point(colour = "orange") +
ylab(label = expression(F[ST])) +
xlab(label = "pos")
p1 <- base +
hypo_anno_r('puella', xmin = 0, xmax = 3)+
hypo_anno_l('nigricans', xmin = 6, xmax = 8, ymin = 1) +
annotate(geom="text", x=5.5, y=3, label=r_t[1]) +
annotate(geom="text", x=3, y=1.5, label=l_t[1])
p2 <- base +
hypo_anno_r('puella', xmin = 0, xmax = 3)+
hypo_anno_l('nigricans', xmin = 5, xmax = 8) +
annotate(geom="text", x=4.5, y=3, label=r_t[2]) +
annotate(geom="text", x=3, y=1.5, label=l_t[2])
p3 <- base +
hypo_anno_r('puella', xmin = 0, xmax = 3)+
hypo_anno_l('nigricans', xmin = 4.5, xmax = 7.5, ymax = 3) +
annotate(geom="text", x=4.5, y=3, label=r_t[3]) +
annotate(geom="text", x=2.5, y=1.3, label=l_t[3])
p4 <- base +
hypo_anno_r('puella', xmin = 0, xmax = 3)+
hypo_anno_l('nigricans', xmin = 5, xmax = 8) +
annotate(geom="text", x=4.8, y=3.5, label=r_t[4])+
annotate(geom="text", x=2.3, y=1, label=l_t[4])
p5 <- base +
hypo_anno_r('puella', xmin = 0, xmax = 3)+
hypo_anno_l('nigricans', xmin = 5, xmax = 8) +
annotate(geom="text", x=4.8, y=3.5, label=r_t[5])
p6 <- base +
hypo_anno_r('puella', xmin = 0.8, xmax = 3.8)+
hypo_anno_l('nigricans', xmin = 5, xmax = 8) +
annotate(geom="text", x=6, y=1, label=r_t[6])+
annotate(geom="text", x=3.3, y=3.7, label=l_t[5])
f <- plot_grid(p1, p2, p3, p4, p5, p6, ncol = 1)
ggsave("hamlet_comic.pdf", plot = f, width = 250, height = 800, units = "mm")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment