Skip to content

Instantly share code, notes, and snippets.

@sckott
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sckott/28a0a5d2c1b374b61421 to your computer and use it in GitHub Desktop.
Save sckott/28a0a5d2c1b374b61421 to your computer and use it in GitHub Desktop.
cat herd using Phylopic via rphylopic, from @ecologician

Install rphylopic

devtools::install_github("sckott/rphylopic")
library('rphylopic')

Make a cat herd

library(ggplot2)
posx <- runif(50, 0, 10)
posy <- runif(50, 0, 10)
sizey <- runif(50, 0.4, 2)
cols <- sample(c("black", "darkorange", "grey42", "white"), 50, replace = TRUE)

cat <- get_image("23cd6aa4-9587-4a2e-8e26-de42885004c9", size = 128)[[1]]
p <- ggplot(data.frame(cat.x = posx, cat.y = posy), aes(cat.x, cat.y))
for (i in 1:50) {
  p <- p + add_phylopic(cat, 1, posx[i], posy[i], sizey[i], cols[i])
}
p + ggtitle("R Cat Herd!!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment