Make memorable plots with memery.
memery is an R package that generates internet memes including superimposed inset graphs and other atypical features, combining the visual impact of an attention-grabbing meme with graphic results of data analysis. Version 0.3.0 of
memery is now on CRAN. The latest development version and a package vignette are available on GitHub.
Below is an example interleaving a semi-transparent ggplot2 graph between a meme image backdrop and overlying meme text labels. The
meme function will produce basic memes without needing to specify a number of additional arguments, but this is not the main purpose of the package. Adding a plot is then as simple as passing the plot to
memery offers sensible defaults as well as a variety of basic templates for controlling how the meme and graph are spliced together. The example here shows how additional arguments can be specified to further control the content and layout. See the package vignette for a more complete set of examples and description of available features and graph templates.
Please do share your data analyst meme creations. Enjoy!
library(memery) # Make a graph of some data library(ggplot2) x <- seq(0, 2 * pi, length.out = 50) panels <- rep(c("Plot A", "Plot B"), each = 50) d <- data.frame(x = x, y = sin(x), grp = panels) txt <- c("Philosoraptor's plots", "I like to make plots", "Figure 1. (A) shows a plot and (B) shows another plot.") p <- ggplot(d, aes(x, y)) + geom_line(colour = "cornflowerblue", size = 2) + geom_point(colour = "orange", size = 4) + facet_wrap(~grp) + labs(title = txt, subtitle = txt, caption = txt) # Meme settings img <- system.file("philosoraptor.jpg", package = "memery") lab <- c("What to call my R package?", "Hmm... What? raptr is taken!?", "Noooooo!!!!") size <- c(1.8, 1.5, 2.2) # label sizes pos <- list(w = rep(0.9, 3), h = rep(0.3, 3), x = c(0.45, 0.6, 0.5), y = c(0.95, 0.85, 0.3)) fam <- c("Impact", "serif", "Impact") col <- list(c("black", "orange", "white"), c("white", "black", "black")) gbg <- list(fill = "#FF00FF50", col = "#FFFFFF75") # graph background # Save meme meme(img, lab, "meme.jpg", size = size, family = fam, col = col[], shadow = col[], label_pos = pos, inset = p, inset_bg = gbg, mult = 2)