Function adapted from from Marc in the box to add a png picture to a plot. Original function in: https://stackoverflow.com/questions/27800307/adding-a-picture-to-plot-in-r

add_image(obj, x = NULL, y = NULL, width = NULL, interpolate = TRUE)

Arguments

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

Logical. Passed to graphics::rasterImage. Indicates whether to apply linear interpolation to the image when drawing.