plotImage: Display an image

View source: R/plotimage.R

plotImageR Documentation

Display an image

Description

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.

Usage

plotImage(obj = NULL, file = NULL, add = FALSE, ...)

Arguments

obj

an object of class nativeRaster function.

file

a path to either a .png file or a .jpeg file.

add

logical. Should images be added on the current graph? If FALSE a new plot is created.

...

additional arguments to be passed to rasterImage function.

Details

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.

Examples

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)
par(op)

inSileco/graphicsutils documentation built on Sept. 12, 2022, 11:13 p.m.