Make memorable plots with memery. v0.3.0 now on CRAN.

November 13, 2017

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.

[original post]

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 inset.

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!

# Make a graph of some data
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[1], subtitle = txt[2], caption = txt[3])
# Meme settings
img <- system.file("philosoraptor.jpg", package = "memery") # image
lab <- c("What to call my R package?", "Hmm... What? raptr is taken!?", "Noooooo!!!!") # labels
size <- c(1.8, 1.5, 2.2) # label sizes, positions, font families and colors
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[[1]],
     shadow = col[[2]], label_pos = pos, inset = p, inset_bg = gbg, mult = 2)

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)