plotImageArray {recolorize}R Documentation

Plot a 3D array as an RGB image

Description

Does what it says on the tin. An extremely simple wrapper for rasterImage, but maintains aspect ratio, removes axes, and reduces margins for cleaner plotting.

Usage

plotImageArray(rgb_array, main = "", ...)

Arguments

rgb_array

A 3D array of RGB values. Preferably output from readPNG, readJPEG, recoloredImage, constructImage, or raster_to_array.

main

Optional title for plot.

...

Parameters passed to graphics::plot.

Value

No return value; plots image.

Examples

# make a 100x100 image of random colors
random_colors <- array(runif(100 * 100 * 3),
                       dim = c(100, 100, 3))
recolorize::plotImageArray(random_colors)

# we can also plot...a real image
corbetti <- system.file("extdata/corbetti.png",
                       package = "recolorize")
img <- png::readPNG(corbetti)
plotImageArray(img)

[Package recolorize version 0.1.0 Index]