For windows users, you need to register your font before using it in R graphics (see discussion here).
meme
Call meme
to add meme captions:
Not that useful, just to mimic ggplot2
:
meme_save
: a meme version of ggsave
The meme
output can be saved as an object, and can be
exported to file using meme_save
. meme_save
helps user setting up the output figure aspect ratio and calls
ggsave
to export the figure:
plot
methodUsers can plot
the meme
output and change
the caption or other parameters in real time.
+
methodInstead of using parameters in plot()
explictely, Users
can use + aes()
to set the plot parameters:
x + aes(upper = "#barbarplots",
lower = "friends don't let friends make bar plots",
color = firebrick, font = Courier, size=1.5)
or using + list()
. The following command will also
generate the figure displayed above.
I didn’t do anything about it. Multi-language was supported internally. Just simply select a font for your language.
library(grid)
mm <- meme(u, "code", "all the things!", size=.3, color='firebrick', bgcolor=NULL)
grid.newpage()
pushViewport(viewport(width=.9, height=.9))
grid.rect(gp = gpar(lty="dashed"))
xx <- seq(0, 2*pi , length.out=10)
yy <- sin(xx)
for (i in seq_along(xx)) {
vp <- viewport(x = xx[i]/(2*pi), y = (yy[i]-min(yy))/2, width=.05, height=.05)
print(mm, vp = vp)
}
In addition to the fonts installed on your system, there are many amusing fonts that are funny for meme, e.g. fonts on https://fontmeme.com/fonts/.
## font Pokemon_Hollow, Pokemon_Solid loaded...
u <- system.file("ash-pikachu.0.0.jpg", package="meme")
meme(u, "Pokemon", "pikachu i choose you!", font='Pokemon_Hollow')
You can download fonts and pass the folder to
font_import()
to import the fonts so that they can be used
to create meme.
## folder that contains bubble1 font
## downloaded from https://fontmeme.com/fonts/bubble-1-font/
dir <- system.file('fonts/bubble', package='meme')
font_import(dir)
## font bubble1 loaded...
Fonts imported by font_import()
are not restricted in
creating meme, you can use them in other visualization packages.