png_to_grob | R Documentation |
This takes a png file and converts it to a grob. This is useful in
combination with ggplot2::annotation_custom()
png_to_grob(source)
source |
name of image to read |
library(ggplot2)
img <- png_to_grob(system.file("img", "Rlogo.png", package = "png"))
ggplot(mtcars, aes(x = mpg, y = wt, color = factor(cyl))) +
geom_point() +
annotation_custom(img, xmin = 25, xmax = 30, ymin = 4, ymax = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.