Package 'meme'

Title: Create Meme
Description: The word 'Meme' was originated from the book, 'The Selfish Gene', authored by Richard Dawkins (1976). It is a unit of culture that is passed from one generation to another and correlates to the gene, the unit of physical heredity. The internet memes are captioned photos that are intended to be funny, ridiculous. Memes behave like infectious viruses and travel from person to person quickly through social media. The 'meme' package allows users to make custom memes.
Authors: Guangchuang Yu [aut, cre]
Maintainer: Guangchuang Yu <[email protected]>
License: Artistic-2.0
Version: 0.2.3
Built: 2024-10-26 03:10:13 UTC
Source: https://github.com/guangchuangyu/meme

Help Index


asp

Description

aspect ratio of meme

Usage

asp(x)

Arguments

x

meme object

Value

asp ratio

Author(s)

guangchuang yu

Examples

## Not run: 
f <- system.file("icon.png", package="meme")
x <- meme(f, "meme", "produced by meme package")
asp(x)

## End(Not run)

font_pokemon

Description

load fonts

Usage

font_pokemon()

font_import(path = ".")

Arguments

path

folder of fonts

Author(s)

Guangchuang Yu


grid.echo.meme

Description

grid.echo method for meme object

Usage

## S3 method for class 'meme'
grid.echo(x = NULL, newpage = TRUE, prefix = NULL)

Arguments

x

meme object

newpage

not use in this method

prefix

not use in this method

Details

using the solution <https://stackoverflow.com/a/18551959/3844636> to not importing grid.echo generics from gridGraphics for easy installation, since gridGraphics has system requirement of ImageMagick <https://github.com/cran/gridGraphics/blob/master/DESCRIPTION#L14>.

this method is just a hack for making cowplot to support meme object, and not used elsewhere.

Value

meme object

Author(s)

guangchuang yu


meme

Description

create meme

Usage

meme(
  img,
  upper = "",
  lower = "",
  size = "auto",
  color = "white",
  font = "Impact",
  vjust = 0.05,
  bgcolor = "black",
  r = 0.2,
  density = NULL
)

Arguments

img

path or url

upper

upper text

lower

lower text

size

size of text

color

color of text

font

font family of text

vjust

vertical adjustment of captions

bgcolor

background color of shadow text

r

ratio of shadow text

density

resolution to render pdf or svg

Value

grob object

Author(s)

guangchuang yu

Examples

f <- system.file("angry8.jpg", package="meme")
meme(f, "code", "all the things!", font = "Helvetica")

meme_save

Description

save meme plot

Usage

meme_save(x, file, width = NULL, height = NULL, ...)

Arguments

x

meme output

file

output file

width

width of graph

height

height of graph

...

additional arguments for ggsave

Author(s)

guangchuang yu

Examples

f <- system.file("angry8.jpg", package="meme")
x <- meme(f, "code", "all the things!")
outfile <- tempfile(fileext = ".png")
meme_save(x, outfile)

memeGrob

Description

convert meme to grob object

Usage

memeGrob(x)

Arguments

x

meme object

Value

grob object

Author(s)

guangchuang yu

Examples

f <- system.file("angry8.jpg", package="meme")
x <- meme(f, "code", "all the things!")
memeGrob(x)

mm_caption

Description

add caption layer for meme

Usage

mm_caption(upper = NULL, lower = NULL, ...)

Arguments

upper

upper caption

lower

lower caption

...

additional parameters to set caption

Value

meme object

Author(s)

guangchuang yu


mmplot

Description

plot the image for meme (captions to be added)

Usage

mmplot(x)

Arguments

x

image file

Value

meme object

Author(s)

guangchuang yu


print method for meme object

Description

print method for meme object

Usage

## S3 method for class 'meme'
print(
  x,
  size = NULL,
  color = NULL,
  font = NULL,
  upper = NULL,
  lower = NULL,
  vjust = NULL,
  bgcolor = NULL,
  r = NULL,
  newpage = is.null(vp),
  vp = NULL,
  newdev = FALSE,
  ...
)

## S3 method for class 'meme'
plot(
  x,
  size = NULL,
  color = NULL,
  font = NULL,
  upper = NULL,
  lower = NULL,
  vjust = NULL,
  bgcolor = NULL,
  r = NULL,
  newpage = is.null(vp),
  vp = NULL,
  newdev = FALSE,
  ...
)

Arguments

x

meme object

size

size of text

color

color of text

font

font family of text

upper

upper text

lower

lower text

vjust

vertical adjustment ratio

bgcolor

background color of shadow text

r

ratio for shadow text

newpage

draw new (empty) page first?

vp

viewport to draw plot in

newdev

open new graphic device?

...

other arguments not used by this method

Examples

f <- system.file("angry8.jpg", package="meme")
x <- meme(f, "code", "all the things!", font = "Helvetica")
print(x)