addImg | R Documentation |
Add image to plot region
addImg(obj, x = NULL, y = NULL, width = NULL, interpolate = TRUE)
obj |
an image file imported as an array (e.g. png::readPNG, jpeg::readJPEG) |
x |
mid x coordinate for image |
y |
mid y coordinate for image |
width |
width of image (in x coordinate units) |
interpolate |
(passed to graphics::rasterImage) A logical vector (or scalar) indicating whether to apply linear interpolation to the image when drawing. |
adds graphics to plot
library(png) myurl <- paste0("https://upload.wikimedia.org/wikipedia/commons/thumb/", "e/e1/Jupiter_%28transparent%29.png/242px-Jupiter_%28transparent%29.png") myurl <- paste0("https://upload.wikimedia.org/wikipedia/commons/4/47/", "PNG_transparency_demonstration_1.png") z <- tempfile() download.file(myurl,z,mode="wb") pic <- readPNG(z) file.remove(z) # cleanup dim(pic) image(volcano) addImg(pic, x = 0.3, y = 0.5, width = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.