Returns a plot that displays an image. It enables users to directly include a
.png
or a .jpeg
file in a plot region by providing their path.
plotImage(obj = NULL, file = NULL, add = FALSE, ...)
obj | an object of class |
---|---|
file | a path to either a |
add | logical. Should images be added on the current graph? If FALSE a new plot is created. |
... | additional arguments to be passed to |
Note that either obj
or file
must be defined.
If a path is provided either readPNG
or readJPEG
according to
the end of the file extension.
img <- png::readPNG(system.file('img', 'Rlogo.png', package='png'), native=TRUE) op <- par(no.readonly = TRUE) par(mfrow=c(4,4), mar=rep(2,4)) for (i in seq_len(16)) plotImage(img)