Learn R Programming

cats (version 0.1)

add_cat: Add a kitty to your ggplot2 plot

Description

Grabs a random cat image from http://theoldreader.com/kittens and creates a annotation_raster layer to add to your ggplot2 plot.

Usage

add_cat(..., lighten = 0.7, bw = TRUE)

Arguments

...
Arguments passed to get_cat, i.e. height and width
lighten
Number between 0 (no adjustment) and 1 (all white) to lighten the image
bw
Logical, the image should be displayed in grey-scale (FALSE = full colour)

Examples

Run this code
library(ggplot2)
ggplot(mpg, aes(cty, hwy)) +
 add_cat() +
 geom_point()

# In glorious kitty colours
ggplot(mpg, aes(cty, hwy)) +
 add_cat(bw = FALSE) +
 geom_point()

Run the code above in your browser using DataLab