Skip to content

Instantly share code, notes, and snippets.

@ColinFay
Created December 6, 2018 11:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColinFay/6ca30c4ef304e03970e06db1be14565f to your computer and use it in GitHub Desktop.
Save ColinFay/6ca30c4ef304e03970e06db1be14565f to your computer and use it in GitHub Desktop.
download.file("https://images1.westword.com/imager/u/745xauto/9813472/mg_3662.jpg", "img.jpg")
img <- jpeg::readJPEG("img.jpg")
library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
annotation_custom(rasterGrob(img,
width = unit(1,"npc"),
height = unit(1,"npc"))) +
geom_point()
unlink("img.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment